Setting up station to connect to Azure IoT Hub

The following steps describe how to prepare your Niagara station to connect it to your created Azure IoT Hub using SAS tokens.

  • You are working in Workbench and your connected station is open.

  • The abstractMqttDriver palette is open.

  1. To create a new AbstractMqttDriverNetwork, expand Config > Drivers, and double-click Drivers to open the Driver Manager view.
  2. In the Driver Manager view, click New, select AbstractMqttDriverNetwork from the drop-down menu, and click OK.
  3. In the open abstractMqttDriver palette, expand the Devices folder.


  4. Drag the AzureSasTokenMqttDevice component to your AbstractMqttDriverNetwork in the Nav tree, name it and click OK.
  5. Expand AzureSasTokenMqttDevice, double-click authenticator and consider the following two optional steps:


    1. Optional: For Advance Expiration, set an appropriate value to define the time period prior to the token’s expiry when a new token is generated replacing the existing token. The default value is 10 seconds.
    2. Optional: Expand Token Parameters and choose an appropriate value for Next Token Expiry Period. By default, the token expires every 24 hours.
  6. Right-click authenticator and select Actions > Setup From Connection String.


  7. In the Setup From Connection String window, paste in the connection string as copied from the Azure IoT Hub device configuration (see section “Setting up Azure IoT Hub on Azure portal”).


    The authenticator populates the following fields and connects the parent device to Azure IoT Hub:
    • Broker Endpoint

    • Client ID

    • Token Parameters

    • Current Token



    Note: The authenticator automatically generates a new token before the current token expires and reconnects the device using the new token. To prompt this procedure manually, you can at any time invoke the Generate New Token action on the authenticator.