0

Long road of learning, and wading through older documents, I finally deploying my IOT Edge module to IOT Hub using this command:

az iot edge set-modules --hubname xxx --device-Id yy --content ./deployment.arm64vf8.json

When I run this command, i review these screens: enter image description here enter image description here

However, how do I set Environmental Variables from the JSON file? enter image description here

codeputer
  • 1,987
  • 3
  • 19
  • 45

1 Answers1

0

The environment variables are in env section of the deployment JSON.

Example:

{
  "modulesContent": {
    "$edgeAgent": {
      "properties.desired.modules.EdgeModule": {
        "version": "1.0.0",
        "type": "docker",
        "status": "running",
        "restartPolicy": "always",
        "settings": {
          "image": "mcr.microsoft.com/dotnet/samples:aspnetapp",
          "createOptions": "{\"PortBindings\":{\"80/tcp\":[{\"HostPort\":\"8080\"}]}}}"
        },
        "env": {
          "ASPNETCORE_ENVIRONMENT": {
            "value": "Production"
          }
        }
      }
    }
  }
}


Alex AIT
  • 17,361
  • 3
  • 36
  • 73
  • Thank you! Can you point me to the documentation please! Is EdgModule you module name, or is it reserved name like system.Modules – codeputer May 30 '23 at 21:35
  • I could not find the docs quickly myself, that is basically taken from our own files. EdgeModule is the module name. – Alex AIT May 31 '23 at 04:29
  • Thanks! I noticed that Intellisense put in the env key when I finally got to the right location in JSON. Kills me that IOT tools would not present a form that allows for the proper configuration and setup of a schema file, which is a schema list. Perhaps that was my first VS tool. I also found that the only way to deploy the JSON is via the "az set edge set-models" statement. Could easily incorporate that as well. You using VSCode for that? – codeputer May 31 '23 at 19:48