---
title: Send Data to Azure IoT Hub with a Device Certificate
slug: litmusedge-v2/how-to-guides/integration-guides/azure-iot-hub/send-data-to-azure-iot-hub-with-device-certificate
description: Learn how to send data to Azure IoT Hub with a device certificate. 
docTags: 
createdAt: 2022-11-24T18:16:58.000Z
---

Review the following guide for setting up an outbound data integration between Litmus Edge and Azure IoT Hub using a Device Certificate.&#x20;

# 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)
- [Sending device-to-cloud messages](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support#sending-device-to-cloud-messages) 
- [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)

# 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&#xA0;**&#x77;hen you add the IoT device in Azure.&#x20;

# Step 1: Add a Device

Follow the steps to [Connect a Device](docId:3eyAfPpweuVmBLCEy17sq). 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** checkbox.&#x20;

# Step 2: Add Tags

After connecting the device in Litmus Edge, you can [Add Tags](docId:8sE7z3PmRfwL1nmzcwaLX) to the device. Create tags that you want to use to create outbound topics for the connector.&#x20;

# Step 3: 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. Define 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.
- **Certificate**: Copy or save the certificate from the **mydevicekeycer.pem** file and paste or upload it here.&#x20;
- **Private Key**: Copy the key from the *myprivatekey.pem* file 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;
- **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 Litmus Edge when cloud providers are online. &#x20;
- **Queue Mode**: Select the queue mode as **lifo&#x20;**(last in first out) or **fifo&#x20;**(first in first out). Selecting **lifo&#x20;**&#x6D;eans that the last data entry is processed first, and selecting **fifo&#x20;**&#x6D;eans the first data entry is processed first.&#x20;

# Step 4: Enable the Connector

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

::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/NfPoJRPuMEBWYUqX9yT81_azureiotdevice.png" size="60" width="369" height="345" position="center" showCaption="false"}

If you see a *Failed&#x20;*&#x73;tatus, you can review the [Connector Logs](docId:3u7JzLDiNeHY8ShVIFD-D) and relevant error messages.&#x20;

# Step 5: Create Outbound Topics for Connector&#x20;

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](docId:19FClype_fbpDvcXXWrb4) 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](docId:3u7JzLDiNeHY8ShVIFD-D) for more information.&#x20;
   - **Data Direction**: Select **Local to Remote - Outbound**.&#x20;
   - **Local Data Topic**: Paste th&#x65;*&#x20;Raw Topic* for the tag created in Step 2. &#x20;
   - **Remote Data Topic**: Enter **integration.raw\.outboundtest**.&#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, ensure the connector is not disabled and still shows a CONNECTED status. &#x20;

# Step 6: View Outbound Messages

You can create a flow in Litmus Edge to view the outbound messages of the connector.&#x20;

**To view outbound messages:**

1. Follow the steps to [Create a Flow](docId\:veYYTE7xdcANgGLzBqya0) 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.
4. Paste the local topic you created in Step 4. &#x20;
5. If needed, configure the *Datahub Subscribe* connection. See the "Step 3: Configure Connector Nodes" section in [Create a Flow](docId\:veYYTE7xdcANgGLzBqya0) to learn more.&#x20;
6. Click **Done**, and then click **Deploy**.
7. Check the *Debug messages* tab. See the *Additional Options* section in [Manage the Flow Canvas](docId\:I2yBjIj6SJ8EurYHJnPKo) for more details.&#x20;
8. Verify that outbound messages are displaying.&#x20;

