---
title: Receive Data from Azure IoT Hub with an SAS Key
slug: bhdo-v1/receive-data-from-azure-iot-hub-with-an-sas-key
createdAt: 2022-11-24T18:17:00.000Z
---

Review the following guide for setting up an inbound data integration between Belden Horizon Data Operations and Azure IoT Hub using an SAS key.

# Before You Begin

You must first [Set up an Azure IoT Hub](docId\:tvuEGnnV66bjo25bbfrKP).&#x20;

# Step 1: Add the Azure IoT Hub Using SAS Key Connector

Follow the steps to [Add a Connector](docId\:rrskXSXVcBZSd6UWyJ-yv) and select the **MQTT - Azure IoT Hub using SAS Key** provider.&#x20;

Configure the following parameters.&#x20;

- **Name**: Enter a name for the connector.&#x20;
- **Hostname**: The IP address or server FQDN of the MQTT broker (must be reachable from your edge device).&#x20;
- **Port**: The MQTT broker's port number. The default value is 8883.&#x20;
- **Device ID**: Copy the **Device ID** of your edge device from th&#x65;*&#xA0;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.&#x20;
- **Parallel Publish Count**: The maximum number of concurrently published messages. The default value is 16.&#x20;
- **Integration Topic**: The default topic to publish or subscribe to: devices/\[deviceId]/messages/events/. Replace `[deviceId]` with the Device ID copied from Azure.&#x20;
- **Token TTL**: The token expiry time in minutes. The default value is 1440.&#x20;
- **LWT Topic**: The topic for MQTT's Last Will and Testament feature.&#x20;
- **LWT payload**: The payload for MQTT's Last Will and Testament feature.&#x20;
- **LWT payload type**: The payload type for MQTT's Last Will and Testament feature. The options are *string&#x20;*&#x61;nd *base64*.&#x20;
- **LWT QoS**: The Quality of Service value for MQTT's Last Will and Testament feature.&#x20;
- **LWT retained**: Select this check box to retain the value for MQTT's Last Will and Testament feature.&#x20;
- **Throttling Limit**: The maximum number of messages per second to be processed. The default value is zero, which means that there is no limit.&#x20;
- **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. &#x20;

# Step 2: Enable the Connector&#x20;

After adding the connector, click the toggle in the connector tile to enable it.&#x20;

::Image[]{src="https://api.archbee.com/api/optimize/vAqK-046vdh4I0e1y9cfX/wAJhTWqtu3RPSHWLbtKcH_azureiotsas.png" size="60" width="370" height="345" position="center" showCaption="false"}

If you see a *Failed&#x20;*&#x73;tatus, review the [Connector Logs](docId\:wciGtqYdwS5P7BnDd7LId) and any relevant error messages.&#x20;

# Step 3: Create Inbound Topics for Connector

You will now need to create inbound topics for the connector that will receive the data from Azure IoT Hub.

**To create topics:**

1. Click the connector tile.
   The connector *Dashboard&#x20;*&#x61;ppears.&#x20;
2. Click the **Topics&#x20;**&#x74;ab.&#x20;
3. Add topics to the connector with the details below. See the *Add a Topic to a Connector* section in [Manage Connectors](docId\:wciGtqYdwS5P7BnDd7LId) for more information.&#x20;
   - **Data Direction**: Select **Remote to Local - Inbound**.&#x20;
   - **Local Data Topic**: Paste th&#x65;*&#x20;Raw Topic* for the tag created in Step 2.&#x20;
   - **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 parameter configured for the connector. &#x20;
   - **Enable**: Click the toggle to enable the topic.&#x20;
4. Click **Yes&#x20;**&#x74;o add the topic.&#x20;
5. After adding all required topics, navigate to the *Integration&#x20;*&#x70;ane and ensure the connector has a *Connected&#x20;*&#x73;tatus.&#x20;

# Step 4: Initiate and View Inbound Messages

You will need to create a flow to view the inbound messages from the connector.&#x20;

**To initiate and view inbound messages:**

1. Follow the steps to [Create a Flow](docId\:MOkTG91ETOVhHW2Py7HpK) and add the following nodes.
   - **DataHub Subscribe**:&#x20;
   - **Debug**
2. Connect the two nodes.&#x20;
3. Double-click the **DataHub Subscribe&#xA0;**&#x6E;ode.
   The *Edit DataHub Subscribe node* dialog box appears.
   - Paste the local topic you created in Step 4. &#x20;
   - If needed, configure the *Datahub Subscribe* connection. See the "Step 3: Configure Connector Nodes" section in [Create a Flow](docId\:MOkTG91ETOVhHW2Py7HpK) to learn more.&#x20;
   - Click **Done**, and then click **Deploy**.
4. Log in to Azure.&#x20;
5. Open the device pane and click **Message to Device**.
   The *Message to device* pane appears.&#x20;
6. Enter **Test Message&#xA0;**&#x69;n the **Message Body&#xA0;**&#x66;ield and click **Send Message**.
7. Open the flow you created in Belden Horizon Data Operations and check the *Debug messages* tab. See the *Additional Options* section in [Manage the Flow Canvas](docId\:eHAO-G4ZFvxocS_Flj-gm) for more details.&#x20;
8. Verify that *Test Message* appears in the debug results.&#x20;

