Azure IoT Hub Producer
The Azure IoT Hub Producer target writes data to Microsoft Azure IoT Hub. To write to Microsoft Azure Data Lake Storage, use the Azure Data Lake Storage target. To write to Microsoft Azure Event Hub, use the Azure Event Hub Producer target. For information about supported versions, see Supported systems and versions.
Use the Azure IoT Hub Producer target in a flow when you want to send device data - such as temperature or sensor data - to Azure IoT Hub after processing the data.
Data Collector functions as a simulated device that sends messages to Azure IoT Hub. Before you configure the Azure IoT Hub Producer target, register Data Collector as a simulated device in your IoT hub.
When you configure the Azure IoT Hub Producer target, you specify connection information such as the IoT hub name and device ID. You also specify the authentication key that the target uses to identify itself when it sends messages to your IoT hub.
Register Data Collector as an IoT Hub device
Data Collector functions as a simulated device that sends messages to Azure IoT Hub. Before you configure the Azure IoT Hub Producer target, register Data Collector as a device in your IoT hub.
Data Collector cannot connect to your IoT hub unless it has an entry in the identity registry. When you register Data Collector as a simulated device, Azure IoT Hub generates a unique device ID and authentication key that Data Collector uses to identify itself when it sends messages to your IoT hub.
- Log in to the Azure portal: https://portal.azure.com.
- Open your IoT hub.
- In the Navigation panel, click Device Explorer.
- To create a device, click Add.
- On the Add Device page, enter the following information:
- Device ID: Enter the ID to use for Data Collector. Device IDs are case sensitive.
- Authentication Type: Select Symmetric Key.
- Auto Generate Keys: Select the checkbox.
- Connect device to IoT Hub: Click Enable.
- Click Save.
- In the Device Explorer pane, select the newly created device.
- Make a note of the device ID and the primary key. When you configure the Azure IoT
Hub Producer target, use these values for the Device ID property and the Shared
Access Key stage property.

Data formats
The Azure IoT Hub Producer target writes data to Microsoft Azure IoT Hub based on the data format that you select. You can use the following data formats:
- Binary
- The stage writes binary data to a single field in the record.
- JSON
- The target writes records as JSON data. You can use one of
the following formats:
- Array - Each file includes a single array. In the array, each element is a JSON representation of each record.
- Multiple objects - Each file includes multiple JSON objects. Each object is a JSON representation of a record.
- SDC Record
- The target writes records in the SDC Record data format.
- Text
- The target writes data from a single text field to the target system. When you configure the stage, you select the field to use.
- XML
- The target creates a valid XML document for each
record. The target requires the record to have a single root field that contains the
rest of the record data. For details and suggestions for how to accomplish this, see Record structure requirement.
The target can include indentation to produce human-readable documents. It can also validate that the generated XML conforms to the specified schema definition. Records with invalid schemas are handled based on the error handling that is configured for the target.
Configuring an Azure IoT Hub Producer target
About this task
Configure an Azure IoT Hub Producer target to write data to Microsoft Azure IoT Hub. Be sure to register Data Collector as a device in your IoT hub before you configure the target.