---
title: Receive Data from Azure IoT Hub with a Device Certificate
slug: bhdo/receive-data-from-azure-iot-hub-with-a-device-certificate
createdAt: 2022-11-24T18:16:55.000Z
---

You can connect to Azure IoT Hub from Belden Horizon Data Operations with SSL using the device certificate and receive data (messages) from that hub.

# Additional Resources

Refer to the following resources for more information.&#x20;

- [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)

:::hint{type="info"}
**Note**: Integration does not support wildcard characters for inbound messages.
:::

# Before You Begin

You must first [Set up an Azure IoT Hub](https://public-docs.litmus.io/bhdo/set-up-an-azure-iot-hub). When you add the IoT device to the hub, select **X.509 Self-Signed** as the **Authentication type&#xA0;**&#x77;hen you add the IoT device in Azure.&#x20;

# Step 1: Retrieve Connector Parameters

You will need to log in to Azure to retrieve the parameters for configuring the connector in Belden Horizon Data Operations.&#x20;

::::hint{type="info"}
**Tip**: Use the following command to generate a public/private key pair:

:::BlockQuote
openssl req -newkey rsa:2048 -nodes -keyout myprivatekey.pem -x509 -days 365 -out mydevicekeycer.pem
:::
::::

**To retrieve the connector parameters:**

1. From the Microsoft Azure home page, click your IoT Hub.
2. From the Navigation panel under *Explorers*, click **IoT devices**.
3. From the *Azure IoT devices&#x20;*&#x70;ane, copy the device name from the **Device ID&#xA0;**&#x63;olumn.
4. Click the **Device ID&#xA0;**&#x66;or the device you want to connect.
5. Copy the **key ID&#xA0;**&#x61;nd paste it to the **Primary Thumbprint&#xA0;**&#x66;ield, and then copy the **certificate ID&#xA0;**&#x61;nd paste it to the **Secondary Thumbprint&#xA0;**&#x66;ield.

# Step 2: Add the Connector in Belden Horizon Data Operations

Follow the steps to [Add a Connector](https://public-docs.litmus.io/bhdo/add-a-connector) and select the **MQTT - Azure IoT Hub using Device Certificates** provider.&#x20;

- **Name**: A recognizable name to identify the connector.&#x20;
- **Hostname**: IP Address or Server FQDN of MQTT broker. 
- **Port**: Verify the default value of 8883 is entered.&#x20;
- **Device ID**: Copy the **Device ID** retrieved in Step 1.
- **Certificate**: Paste the certificate from the **mydevicekeycer.pem** file generated in Step 1.&#x20;
- **Private key**: Paste the key certificate from the **myprivatekey.pem&#xA0;**&#x66;ile generated in Step 1.&#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.&#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 4: Create Topics for Azure Connector

You will now need to create topics from the tags you added in Step 2.&#x20;

Before creating the topics copy the *Raw Topic* parameter for all tags you want to use for topics. See [Manage Tags](https://public-docs.litmus.io/bhdo/manage-tags) for more information.

**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](https://public-docs.litmus.io/bhdo/manage-connectors#add-a-topic-to-a-connector) for more information.&#x20;
   - **Data Direction**: Select **Remote to Local - Inbound**.&#x20;
   - **Local Data Topic**: Enter **integration.raw\.inboundtest**.&#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 value 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.
6. From the connector tile, click the toggle to enable the connector.

   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/S5D6r7VoDN-M1t0fW_yJi_azurecertificates.png" size="60" width="352" height="263" caption="Toggle to enable connector" position="center" showCaption="true"}

# Step 5: 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](https://public-docs.litmus.io/bhdo/create-a-flow) and add the following nodes.
   - **DataHub Subscribe**:&#x20;
   - **Debug**
2. Double-click the **DataHub Subscribe&#xA0;**&#x6E;ode.
   The *Edit DataHub Subscribe node* dialog box appears.
3. Enter **Azure inbound&#xA0;**&#x69;n the **Name&#xA0;**&#x66;ield.
4. Paste the Topic you created in Step 4 in the **Topic&#xA0;**&#x66;ield.&#x20;
5. If needed, configure the *Datahub Subscribe* connection. See the "Step 3: Configure Connector Nodes" section in [Create a Flow](https://public-docs.litmus.io/bhdo/create-a-flow#step-3-configure-connector-nodes) to learn more.&#x20;
6. Click **Done**, and then click **Deploy**.
7. Click the **debug&#xA0;**&#x74;ab.
8. Log in to Azure.&#x20;
9. Open the device pane and click **Message to Device**.
   The *Message to device* pane appears.&#x20;
10. Enter **Test Message&#xA0;**&#x69;n the **Message Body&#xA0;**&#x66;ield and click **Send Message**.
11. 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](https://public-docs.litmus.io/bhdo/manage-the-flow-canvas) for more details.&#x20;
12. Verify that *Test Message* appears in the debug results.&#x20;

