Using Twin Setting for Environment Variables of Module

Clemens Mohr 1 Reputation point

Is it possible to link an environment variable of a module with parameters from the Device Twin settings? We are using Layered Deployments in IOT HUB and we need to be able to set the environment variables device-specifically. All devices are provisioned via DPS, which is why the device twin settings would be ideal for this.

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,133 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde 29,456 Reputation points MVP

    Hello @Clemens Mohr ,

    at this moment for Azure IoT Edge, device twin settings, module twin settings, and module environment variables are not directly related:

    1. For an Azure IoT Edge device, the device twin is basically ignored from a device perspective. There is no (user written) logic listening to device twin changes.
    2. Module twin settings (like desired and reported properties) are controlled first by the initial Deployment manifest and later on using the event/callback mechanism
    3. Module environment variables are only controlled by the deployment manifest. Changing the deployment manifest will 'touch' all modules

    As far as I know, Docker environment variables are also static, not dynamically changeable. Correct me if I'm wrong.

    On the other hand, this would be a nice feature. As seen here, you can share your idea here.