Search code examples
azure-iot-hubazure-iot-edge

Azure IotHub download edge device configuration


I am looking for an endpoint in Azure IotHub to download the full configuration of an edge device.

{
    "modulesContent": {
      "$edgeAgent": {
        "properties.desired": {
          "modules": {...
          "runtime": {...
          "schemaVersion": "1.0",
          "systemModules": {
            "edgeAgent": {...
            "edgeHub": {...
        }
      },
      "$edgeHub": {
        "properties.desired": {...
      }
    }
  }

There is an endpoint to apply the configuration, but I just cannot find a way to access the configuration with code :-)

Can someone point me to the right direction?

Thanks


Solution

  • One option to query the local configuration is:

    az iot hub module-twin show -n <name-of-your-hub> -d <edge-device-name> -m '$edgeAgent'
    

    If you want to query a current status you can add --query 'properties.reported.modules'

    In addition when you have the module ids you can query the module twin as well using:

    az iot hub module-twin show --hub-name <name-of-your-hub> --device-id <edge-device-name> --module-id <module-name>
    

    Hopefully it answers your question