codeputer
codeputer

Reputation: 2028

Azure IOT Hub module / Environmental Variable

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

Upvotes: 0

Views: 353

Answers (1)

Alex
Alex

Reputation: 18556

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"
          }
        }
      }
    }
  }
}


Upvotes: 0

Related Questions