iotedge deployment set module environment value per device for multidevice deployment

Gopikrishnan Bahuleyan Pillai 31 Reputation points

Looking for workarounds here

I am creating a single edge deployment with target condition tags.environment = 'pilot'. This target condition results to multiple edge devices.

Requirement: I need to have unique module environment value per device.
Problem : I only have one deployment.json in this case and can only set environment value once that will apply for all devices->modules.

Straight alternative : I can use individual deployments targeting individual devices. Allowing me to have separate deployment jsons which can have unique module environment value per device. This alternative is doable; but preferring a deployment targeting multiple edge devices.

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
547 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. António Sérgio Azevedo 7,666 Reputation points Microsoft Employee

    Hello @GopikrishnanBahuleyan-2250 ,
    Want to be sure that you have looked at the following doc?:

    Specifically the section Layered deployment may be the solution for your scenario.

    "Layered deployments are automatic deployments that can be combined together to reduce the number of unique deployments that need to be created. Layered deployments are useful in scenarios where the same modules are reused in different combinations in many automatic deployments."


    Thank you.


    • Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification.
    1 person found this answer helpful.

  2. Gopikrishnan Bahuleyan Pillai 31 Reputation points

    For this odd need, I think Docker CMD could be choice. And I am trying to use it. This would give an option to set a new value to an environment variable and module instance could use it.

  3. Victor Velghe 1 Reputation point


    I'm hurting the same issue. I'm using layered deployment for multi-devices.

    I need my deployment to use device specific values.

    I cannot use the createOptions from the deployment since it's not device specific.

    Is there a way to inject ENV variables in a device? In the /etc/iotedge/config.yaml?

    Where come from those ENV variables?

    Can I add one?

    Or Is it possible to use device's tags in a module?

    Thanks for you help!

    0 comments No comments