Device Streams with Azure IoT Edge
Introduction
Device Streams is a feature to access IoT devices via IoT Hub. The IoT Hub acts as a proxy and no direct ingoing connection needs to be established.
Disclaimer: Azure IoT Hub currently supports device streams as a preview feature.
Using Device Streams on IoT Edge devices
To be able to use device streams on an IoT Edge device (which is hosting Docker containers), there are two options:
- Install the device client in addition to IoT Edge
- deploy a module which contains the device client
The sample I have created is using IoT Edge 1.2 capabilities to create a SAS token that is then used to connect to the IoT Hub. There is no need store credentials/connectionstring with this pattern.
In a previous post I wrote about how to generate a SAS token automatically. This has been used for the solution that is based on the provided sample for Device Streams.
Take a look at the mentioned repository to see how to configure the edge target. You can use the IoT Edge module (Docker Image) that I provided.
Summary
Add ghcr.io/renehezser/devicestreamproxy:latest
to your deployment manifest for an IoT Edge device to be able to remote SSH into it.
You will also need the Cloud part (the service folder in the repository) that is available here.
Links
- https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-device-streams-overview
- https://github.com/ReneHezser/iot-edge-devicestreams
- https://github.com/Azure-Samples/azure-iot-samples-csharp/tree/main/iot-hub/Quickstarts/device-streams-proxy
- https://github.com/ReneHezser/iot-edge-devicestreams/pkgs/container/devicestreamproxy