Cloud Sink with Azure IoT Hub

This page addresses how the Cloud Sink object can be used to send messages to the Azure IoT Hub using the MQTT protocol.

For authentication the X.509 CA Certificate Authentication method is recommended and used in the following steps. Alternatively the SAS Token Authentication can be used.

Requirements

The following things are required to establish a connection between the system and the Azure IoT Hub:

  • Azure account with a valid subscription and all the necessary permissions to add and manage resources. There also should be at least one Resource Group. More information about Resource Groups is available on the official Microsoft Documentation webpage.

  • Access to an IoT Hub. The configuration of a sample IoT Hub for testing purposes is described here.

  • Azure IoT Device with the Device Key and Device Certificate files. Instructions for creating a sample IoT Device, key and certificate are available here.

  • The DigiCert Baltimore Root Certificate file

Cloud Sink Configuration

1 Create a new Cloud Sink object.

2 Select the new Cloud Sink object and in the Object Lens.

3 Expand the Configuration property compound and for the Interface select MQTT Publisher.

4 Expand MQTT Publisher Parameters property compound and configure the following parameters:

  • For the Topic property, enter a string following this pattern:

    devices/<DEVICEID>/messages/events/

    where <DEVICEID> matches the Device ID from step 3 of the previous section. In this example 'devices/indevice/messages/events/' is used.

5 Expand the Connection Parameters property compound and configure the following parameters:

  • For the Broker Address property, enter a string following this pattern:

     <HUBNAME>.azure-devices.net

    where <HUBNAME> is the name of your Azure IoT Hub.
    In our Sample Azure IoT Hub the IoT Hub is called 'inmationMqttTest', so 'inmationMqttTest.azure-devices.net' is used.

  • For the Broker Port property, enter 8883.

  • For the Client ID property, enter the Device ID from step 3 of the previous section. In this example 'indevice' is used.

6 Configure Credentials and SSL parameters:

  • For Username property, enter a string following this pattern:

    <HUBNAME>.azure-devices.net/<DEVICEID>/?api-version=2018-06-30

    where <HUBNAME> is the name of your Azure IoT Hub and <DEVICEID> refers to the Device ID created in the previous section.
    In this example, 'inmationMqttTest.azure-devices.net/indevice/?api-version=2018-06-30' is used.

For the x.509 Authentication algorithm, the password field stays clear.

7 Expand the SSL/TLS Support property compound and import the necessary certificates:

  • For the Certificate Authority property, import the DigiCert Baltimore Root certificate ('certs.cer)

  • For the Client Certificate property, import the Device Certificate ('device.crt')

  • For the Client Key property, import the Device Key file ('device.key')

8 Click Apply in the Object Lens to save configuration.

Checking Functionality

Now you can check the functionality of the Cloud Sink object.