Skip to content

Azure IoT EdgeHub Dev Tool

Koichi Hirao - MSFT edited this page Aug 22, 2022 · 5 revisions

Overview

The Azure IoT EdgeHub Dev Tool provide a local development experience with a simulator for creating, developing, testing, running, and debugging Azure IoT Edge modules and solutions.

  • The bits/code of Edge module running on simulator and IoT Edge Runtime are same.
  • The Edge solution could be run with the simulator locally without pushing image and creating IoT Edge deployment.
  • The credential needed to run Edge solution on simulator is IoT Edge Device Connectionstring. And IoT Hub Connectionstring is not needed.
  • It helps to debug the module on the host (not in container) with the EdgeHub

The following table compares the steps needed to run the solution on the IoT Edge Runtime and iotedgehubdev tool.

IoT Edge Runtime iotedgehubdev
Device Credential Needed YES YES
IoT Hub Credential Needed YES NO
Build Image YES YES
Push Image YES NO
Create Deployment YES NO
Support native debug scenario No YES

Components Comparison

The Azure IoT Edge Runtime sits on the IoT Edge device, and performs management and communictaion operations. It consists of

  • Security Daemon: It manages the credential of each IoT Edge Module and provide the credential to IoT Edge Module to open connection to edgeHub.
  • edgeAgent: It gets the deployment of IoT Edge Device from IoT Hub. And it installs and starts each IoT Edge Module according to the deployment. It also ensures that IoT Edge Modules are always running and reports module health to the cloud.
  • edgeHub: Enables the communication between downstream leaf devices and IoT Edge device, the communication between modules on the IoT Edge device, and also the communication between IoT Edge device and the cloud.

The Azure IoT EdgeHub Dev Tool simplifes the deployment and security parts of Azure IoT Edge Runtime. And is focused on the functionality necessary for developing cycle. It gets rid of Seurity Daemon and edgeAgent.

IoT Edge Runtime iotedgehubdev
Security Daemon YES NO
edgeAgent YES NO
edgeHub YES YES

How it works

Without Security Daemon and edgeAgent, how does Azure IoT EdgeHub Dev Tool connect to edgeHub and manage the deployment?

Connection Credential

Module Client are created from environment (CreateFromEnvironment API in device SDK). There are two set of environments supported in SDK.

  • Use connection string: if module gets environment variables
    • EdgeHubConnectionString
    • EdgeModuleCACertificateFile
  • Get credential from Security Daemon: no connection string got in environment variables. And user the following environment variables to get credential from Security Daemon
    • IOTEDGE_WORKLOADURI
    • IOTEDGE_GATEWAYHOSTNAME
    • IOTEDGE_DEVICEID
    • IOTEDGE_MODULEID
    • IOTEDGE_MODULEGENERATIONID
    • IOTEDGE_AUTHSCHEME

So the EdgeHub Dev Tool leverages the first environment to open the connection to edgeHub. It will set the "EdgeHubConnectionString" and "EdgeModuleCACertificateFile" values to the environment for module to start.

Note: Since the environment detail is hidden behind SDK, so the same piece of code could run both in Azure IoT Edge Runtime and Azure IoT EdgeHub Dev Tool.

Module Management

We need to install and manage the Edge Modules running on the Edge Device. In Azure IoT Edge Runtime, edgeAgent does this part of work. It gets the deployment from cloud and create/start each module.

In Azure IoT EdgeHub Dev Tool, module management part is implemented through leveraging docker compose. Deployment manifest of the IoT Edge Device is translated to docker compose file behind the scene. And docker compose will start all the modules.

Besides, the routes configuration of edgeHub is set locally instead of edgeHub device twin. edgeHub provides a flag to get routes configuration from environment variable. EdgeHub Dev Tool uses this flag to set the routes into environment.

Following table summerizes the design detail

IoT Edge Runtime iotedgehubdev
Connection Credential Security Daemon Connection String
Module Management edgeAgent Docker Compose
edgeHub Routes edgeHub Device Twin Environment Variable
Clone this wiki locally