How to send data to Azure IoT Hub

In this tutorial you will learn how to send data to Azure IoT Hub

Benefits of the Azure IoT Hub output connector:

  • Directly stream device data from akenza to Azure and subsequently process it in Azure services

  • Easily process low-power device data e.g. LoRaWAN device data in a Microsoft service

In this tutorial, you will learn, how to send data to Azure IoT Hub. The following steps are explained in more detail:

1. Setup an Azure IoT Hub

First, you will need to set up an Azure IoT Hub in order to successfully process data from akenza in Azure services.

1.1 Create an IoT Hub resource

  • Sign in to the Azure portal

  • Create a new Azure IoT Hub resource, by selecting + Create a resource, and then entering IoT Hub

  • Assign a resource group by choosing an existing group or creating a new one and fill the IoT hub name and region fields; choose Public access in the networking tab to select a tier that fits your use case in the Management tab (use the free tier for testing)

  • Select review and create to provision the IoT hub resource

1.2 Add a shared access policy

  • Navigate to your IoT Hub resource and select Shared access policies in the Settings section

  • Select + Add shared access policy, give a name and check all boxes for the permissions (registry read, registry write, service connect, and device connect permissions)

2. Obtain an Azure IoT Hub connection string

Once the policy is created, obtain the Primary Connection String, by clicking the policy and copying the connection string. The connection string will be used to create the connector in akenza.

3. Setup a Data Flow in akenza

Create a new Data Flow with Azure IoT Hub as output connector. Define a Connector Name and insert the Connection String obtained from the shared access policy.

Create a new device using the Data Flow and start sending data.

  • The whole data sample will be forwarded to Azure IoT Hub

  • If a device sends data and does not yet exist in the registry of IoT Hub, it will be automatically created

4. Monitor Events

In order to monitor uplinks that are sent to Azure IoT Hub, you can use Azure CLI with the Azure IoT CLI Extension. Use the following commands to install the extension and monitor incoming uplinks:

az extension add --name azure-iot
az iot hub monitor-events -n <azure-iot-hub-name> --login <azure-iot-hub-connection-string>

All devices which have sent data can be inspected in the IoT Device Explorer on IoT Hub.

5. Use of further Azure services

Once a device is connected to the IoT Hub, device data can be further used on various Azure services:

Possible services are:

Last updated