Azure IoT Hub
The Microsoft Azure IoT Hub is an IoT Platform to manage Edge devices and process data streams.
The hopit Edge Azure Target features Data streaming, Namespace discovery, Device Twin synchronization and remote Tasks execution.
For further information visit the IoT Hub documentation.
With the hopit Provisioning service, an automatic device provisioning of Azure devices is possible.
Configurationโ
Azure IoT Hubโ
A new device must be created on the IoT Hub and either the Primary Connection String, the Secondary Connection String or a generated SAS Token Connection String must be known.
To generate SAS Token Connection Strings, the Azure-IoT-Explorer can be used.
hopit Edgeโ
The Azure Target has the following parameters:
DeviceConnectionString: Either thePrimary Connection String, theSecondary Connection Stringor a generatedSAS Token Connection String.DeviceConnectionStringRotate: Can be used to renew the SAS Token. See the SAS Token Update section for details.MessageSizeLimitBytes: The maximum message size inbytes. Bigger messages will be split automatically.Properties: Properties added to each message to this Target.TransportType: The transport protocol.AmqpMqttHttp1: Direct methods are not supported with this transport type.Amqp_WebSocket_OnlyAmqp_Tcp_OnlyMqtt_WebSocket_OnlyMqtt_Tcp_Only
TargetType: The type is alwaysAzurefor this Target.
For the common parameters, see the Introduction.
Corresponding Edge configuration and Device Twin definition to activate the Azure Target service:
- Edge-UI
 - Device Twin
 

IoT Hub is in this example the Name of the Target. This can be any unique name.
{
  "IoT Hub": {
    "TransportType": "Amqp",
    "DeviceConnectionString": "HostName=hopit.azure-devices.net;DeviceId=Edge-97223;SharedAccessSignature=SharedAccessSignature sr=hopit.azure-devices.net%2Fdevices%2FEdge-97223&sig=****&se=1692890366",
    "DeviceConnectionStringRotate": null,
    "TargetType": "Azure",
    "Properties": {},
    "MessageSizeLimitBytes": 200000,
    "MessagesPerSecondLimit": 10.0,
    "BufferSize": 100,
    "Constants": {},
    "Enabled": true
  }
}
Data Streamingโ
Signals and properties will be sent to the IoT Hub as a JSON message:
A sample message could be
{
  "body": {
    "signal-1": "value-1",
    "signal-2": "value-2"
  },
  "properties": {
    "property-1": "property-value-1",
    "property-2": "property-value-2"
  }
}
Big messages will be split into two or more messages if the MessageSizeLimitBytes parameter is exceeded.
Signals can be also read with Regex matcher. See the Router documentation for details.
Signal discovery is available for this Target. See the Introduction for more details.
For information how signals are named and labeled in Data Lakes, please read the Data Lake documentation.
Device Twinโ
The Azure Device Twin is split into two sections: desired and reported. All changes made on the Edge device, will be send to the reported section of the Device Twin. To change a settings on the Edge device from the IoT Hub, edit the desired section.
To enable Device Twin synchronization, the Target must be enabled in the Device Twin settings. The Device Twin documentation also contains more information how to use it.
Since the Azure IoT Hub does not support some special characters in the property names, they are replaced by the Device Twin service on the Edge:
.->>$->ยง#->|(white space) ->~
To remove properties from the desired section, set it to null.
Target or Route deletionโ
To delete a Target or a Route via the Device Twin, it has to be set to null.
To delete a Target or a Route via the Azure IoT Hub Device Twin, it must be available in the desired section before setting it to null. Otherwise this null property will not be sent to the Edge device. This is the standard behaviour of the Azure IoT Hub.
SAS Token Updateโ
SAS Tokens are always generated for a period of time and must be replaced before expiring. To automate this task, the DeviceConnectionStringRotate parameter can be used.
If this is set to a new SAS Token Connection String, the Target will try to connect with the new SAS Token. If it connects successfully to the IoT Hub, it copies the new Token to the DeviceConnectionString property and sets the DeviceConnectionStringRotate property to null. If the connection fails with the new Token, it rotates back to the old SAS Token.
Tasksโ
To remotely execute Tasks on the Edge device, the Direct Method feature is used. To trigger a Task execution, invoke a method with the Task name as Method name and add the Arguments as Payload.
Please read the Tasks documentation for more information about Tasks.
Start Discovery Taskโ
The StartDiscovery Task can only be executed from a remote target. See the Tasks documentation for details.
The namespace is sent back as telemetry messages with the discovered signals in the body and with the Properties "type": "configuration" and "target": "[Target Name]".