1. First please add a test hub in your Azure account:
you need to create a IoT Hub and a Resource Group
2. Add device
3. Choose device certification method
- To Use CertifiateAuthority
we need to download tools to create the certificates for the device.
For the 3rd party mqtt test tool such MQTT FX, you may need to download the Root Certicate at: https://github.com/Azure/azure-iot-sdk-c/blob/master/certs/certs.c, but for the HMI PM4, we don't need it.
- To Use SAS password
we need to install VisualStudio Code Azure Extension to apply the SAS password
4. Tools
- Azure CLI
and need to install Azure IoT extension
- VSCode Azure Extension
5. Generate SAS password
To generate the device SAS passowrd, just right click the device in VSCode Azure Cli extension.
You will be asked for enter the hours of the expiration.
6. For testing the publish message
open the powershell for windows, use Azure CLI to enter the command and listen to the events:
7. For testing the subscription of topic
use VSCode Azure Extension to send "Cloud to Device" message, and see what happends on the device