How-To Guides
...
Integration Guides
Azure IoT Hub Guides

Receive Data from Azure IoT Hub with a Device Certificate

8min
review the following guide for setting up an inbound data integration between litmus edge and azure iot hub using a device certificate additional resources refer to the following resources for more information send device to cloud and cloud to device messages with iot hub https //docs microsoft com/en us/azure/iot hub/iot hub devguide messaging?wt mc id=portal microsoft azure iothub#message format using the mqtt protocol directly (as a module) https //docs microsoft com/en us/azure/iot hub/iot hub mqtt support#using the mqtt protocol directly as a module receiving cloud to device messages https //docs microsoft com/en us/azure/iot hub/iot hub mqtt support#receiving cloud to device messages note integration does not support wildcard characters for inbound messages before you begin you must first set up an azure iot hub docid\ ibr6xwso2itgudtivu7vt when you add the iot device to the hub, select x 509 self signed as the authentication type when you add the iot device in azure step 1 retrieve connector parameters you will need to log in to azure to retrieve the parameters for configuring the connector in litmus edge tip use the following command to generate a public/private key pair openssl req newkey rsa 2048 nodes keyout myprivatekey pem x509 days 365 out mydevicekeycer pem to retrieve the connector parameters from the microsoft azure home page, click your iot hub from the navigation panel under explorers , click iot devices from the azure iot devices pane, copy the device name from the device id column click the device id for the device you want to connect copy the key id and paste it to the primary thumbprint field, and then copy the certificate id and paste it to the secondary thumbprint field step 2 add the azure iot hub using device certificates connector follow the steps to add a connector docid\ ogw7fkqbwidbabn4wl5rr and select the mqtt azure iot hub using device certificates provider configure the following parameters name enter a name the connector hostname ip address or server fqdn of mqtt broker port verify the default value of 8883 is entered device id copy the device id retrieved in step 1 certificate paste the certificate from the mydevicekeycer pem file generated in step 1 private key paste the key certificate from the myprivatekey pem file generated in step 1 parallel publish count the maximum number of concurrently published messages the default value is 16 integration topic the default topic to publish or subscribe to token ttl the token expiry time in minutes the default value is 1440 lwt topic the topic for mqtt's last will and testament feature lwt payload the payload for mqtt's last will and testament feature lwt payload type the payload type for mqtt's last will and testament feature the options are string and base64 lwt qos the quality of service value for mqtt's last will and testament feature lwt retained select this check box to retain the value for mqtt's last will and testament feature throttling limit the maximum number of messages per second to be processed the default value is zero, which means that there is no limit persistent storage when enabled, this will cause messages to undergo a store and forward procedure messages will be stored within litmus edge when cloud providers are online queue mode select the queue mode as lifo (last in first out) or fifo (first in first out) selecting lifo means that the last data entry is processed first, and selecting fifo means the first data entry is processed first step 3 enable the connector after adding the connector, click the toggle in the connector tile to enable it if you see a failed status, you can review the manage connectors docid 3u7jzldinehy8shvifd d and relevant error messages step 4 create inbound topics for connector you will now need to create inbound topics to receive data from azure iot hub to create topics click the connector tile the connector dashboard appears click the topics tab add topics to the connector with the details below see the add a topic to a connector section in manage connectors docid 3u7jzldinehy8shvifd d for more information data direction select remote to local inbound local data topic enter integration raw\ inboundtest remote data topic replace devices/\[device id]/messages/events/ with devices/\[device id]/messages/devicebound/%24 to=%2fdevices%2fmessages%2fdevicebound replace \[device id] with the device id value configured for the connector enable click the toggle to enable the topic click yes to add the topic after adding all required topics, navigate to the integration pane from the connector tile, ensure the connector is not disabled and still shows a connected status step 5 initiate and view inbound messages you will need to create a flow to view the inbound messages from the connector to initiate and view inbound messages follow the steps to create a flow docid\ veyyte7xdcangglzbqya0 and add the following nodes datahub subscribe debug double click the datahub subscribe node the edit datahub subscribe node dialog box appears enter azure inbound in the name field paste the topic you created in step 4 in the topic field if needed, configure the datahub subscribe connection see the "step 3 configure connector nodes" section in create a flow docid\ veyyte7xdcangglzbqya0 to learn more click done , and then click deploy click the debug tab log in to azure open the device pane and click message to device the message to device pane appears enter test message in the message body field and click send message open the flow you created in litmus edge and check the debug messages tab see the additional options section in manage the flow canvas docid\ i2ybjij6sj8euryhjnpko for more details verify that test message appears in the debug results