Azure IoT Hub Producer
The Azure IoT Hub Producer destination writes data to Microsoft Azure IoT Hub. To write to Microsoft Azure Data Lake Storage, use the Azure Data Lake Storage destination. To write to Microsoft Azure Event Hub, use the Azure Event Hub Producer destination. For information about supported versions, see Supported Systems and Versions in the Data Collector documentation.
Use the Azure IoT Hub Producer destination in a pipeline 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 destination, register Data Collector as a simulated device in your IoT hub.
When you configure the Azure IoT Hub Producer destination, you specify connection information such as the IoT hub name and device ID. You also specify the authentication key that the destination 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 destination, 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 destination, use these values for the Device ID property and the Shared
Access Key stage property.
Data Formats
The Azure IoT Hub Producer destination 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 destination 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 destination writes records in the SDC Record data format.
- Text
- The destination writes data from a single text field to the destination system. When you configure the stage, you select the field to use.
- XML
- The destination creates a valid XML document for each record. The
destination 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 destination 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 configured for the destination.
Configuring an Azure IoT Hub Producer Destination
Configure an Azure IoT Hub Producer destination 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 destination.