How To Create a Device in Azure IoT Hub
A device must be created or registered in Azure IoT Hub in order for it to be added as an IoT Edge device to IoT Hub. This allows the device to run IoT edge modules and to send and receive telemetry data, and receive c2d messages from the IoT cloud.
In one approach, IoT Edge devices (sensors) and gateway devices can be added to an IoT Hub from the Azure Portal. In the next step, a descriptive device ID must be created for the device, and a symmetric key must be selected to enable authentication. The default settings can then be used to auto generate authentication keys and to connect the device to the IoT Hub. Once the device is registered in the IoT Hub, the information can be retrieved to complete the installation and provisioning of the IoT Edge runtime. The IoT Edge Runtime encapsulates all the programs required to run a device as an IoT edge device within the Azure environment. The IoT Edge runtime program collection also enables the device to run IoT Edge modules. Devices using symmetric key authentication use their connection strings to complete the install and provisioning of IoT Edge Runtime. The connection string links the physical device to its identity in the IoT Hub.
For an edge device to connect to an IoT Hub, it must be entered into the Azure IoT Hub identity registry. The IoT Hub has already been created and the device has been registered. Then the IoT Edge Runtime file is installed and started. An IoT Edge module is then deployed and the generated data is viewed. The resources are normally cleaned up after this step. The process of installing the IoT Edge Runtime is described in this Microsoft documentation .
Sending messages from device to cloud
An IoT Hub device is typically connected to the IoT cloud using JSON and MQTT. The sensor detection data is read in from the device, a connection is then made with the MQTT broker in the cloud, and the data is published as a JSON object to the MQTT broker.
In IoT Hub, each device uses the D2C (receive cloud to to device) endpoint for accessing the cloud and sending messages in the form of telemetry data and feedback for a received command. Device details are stored in Azure IoT Hub in the JSON and Apache Avro formats.
Provisioning a device through the Azure Device Provisioning Service is summarised here .
Mender integrated with IoT Hub
The best place to do a test of the Azure Mender integration for OTA software updates to devices in the IoT Hub is to sign up for a new Mender Enterprise Free trial and all features and add-ons are available for 12 months for free; and refer to the Github documentation on the existing integration.
We are currently working on making major enhancements to the Azure IoT Hub - Mender integration. This will help Mender users get more efficiency, productivity and insights from device provisioning and inspection, from using the two systems together.
If you would like a sneak preview of these upcoming integration improvements, please visit our preview page and leave your email address for updates.
To learn about device updating and device provisioning in Azure IoT, check our the following articles: