How-To Guides
...
Azure IoT Hub Guides
Send Data to Azure IoT Hub with an SAS Key
7 min
review the following guide for setting up an outbound data integration between belden horizon data operations and azure iot hub using an sas key before you begin you must first docid\ pms3cnfw5k2cbsueer8pu step 1 add a device in belden horizon data operations follow the steps to docid\ t cwpe0 jsfw5 aoj8wpp the device will be used to store tags that will be eventually used to create outbound topics in the connector make sure to select the enable data store check box step 2 add tags after connecting the device in belden horizon data operations, you can docid\ wpe2hmxelarlbnhwbuchy to the device create tags that you want to use to create outbound topics for the connector step 3 add the azure iot hub using sas key connector follow the steps to docid\ orxib vla2ngvdx94z1ow and select the mqtt azure iot hub using sas key provider configure the following parameters name enter a name for the connector hostname the ip address or server fqdn of the mqtt broker (must be reachable from your edge device) port the mqtt broker's port number the default value is 8883 device id copy the device id of your edge device from the iot devices page in the azure portal and paste it here sas key copy the primary or secondary shared access key from the iot devices page in the azure portal and paste it here 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 devices/\[deviceid]/messages/events/ replace \[deviceid] with the device id copied from azure 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 belden horizon data operations when cloud providers are online step 4 enable the connector step 5 create outbound topics for connector you will now need to create topics from the tags you added in step 2 before creating the topics copy the raw topic parameter for all tags you want to use for topics see docid\ nrpe2viswydkgecoswzq0 for more information 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 docid\ ocbqwycy xmmkwv9aunq for more information data direction select local to remote outbound local data topic paste the raw topic for the tag created in step 2 remote data topic verify the format of the remote data topic is devices/\[deviceid]/messages/events/ replace \[deviceid] with the device id parameter configured for the connector devices/mydevice/messages/devicebound/%24 to=%2fdevices%2fmessages%2fdevicebound enable click the toggle to enable the topic click yes to add the topic after adding all required topics, navigate to the integration pane and ensure the connector shows a connected status step 6 create testtable and mapping to create a testtable and mapping log in to the azure portal open the device pane click the iot hub link, and then click the datapub link scroll down to display the iot messages click the home link, and then click azure data explorer the azure data explorer clusters pane appears click the clusterduck link the clusterduck pane appears from the right pane, click query the query pane appears to the right click testdb the create table testtable (temperature string); line appears click run the testtable schema appears below and testtable appears beneath testdb replace create table testtable (temperature string); with create table testtable ingestion json mapping 'mapping' '\[{"column" "temperature","path" "$","datatype" "string"}]'; , and then click run the mapping json appears below click the expand icon next to testtable to reveal temperature (string) step 7 add a data connection in azure to add a data connection in azure on the azure home page, from the left navigation pane under data , click databases click the testdb link the testdb pane appears from the left pane, click data ingestion the data ingestion pane appears from the right pane, click add data connection the data connection pane appears to the right from the select connection type drop down listm select iot hub the iot hub dialog box drops down from the iot hub dialog box, enter conn in the data connection name field from the iot hub drop down list, select datahub from the shared access policy drop down list, select iothubowner from the consumer group drop down list, select $ default in the table field, enter testtable from the data format drop down list, select json in the column mapping field, enter mapping click create the data connection appears in the data connection list from the left navigation panel, click query the query pane appears enter select from testtable; in the query line, and then click run the values for testtable appear below