I have 100+ edge devices with multiple modules, managed by an automatic deployment. Each device has it's own characteristics, like max allowed values. We also have an external module which requires account credentials (id/password/certificate/key) unique for each device.
I tried:
- update the module twin directly/manually, but this fails as we use automated deployment for all other settings and configuration, see IotEdge module twin update gets reverted
- using module twin updates with layered deployments. This works, however we have to create a layered deployment for each device. Only 100 deployments are supported by iot hub, so not scalable.
How can I get this this done? Does IoT Edge have a recommended approach / support / workaround for this? Or should we build something our self?
Example of the layered deployment to enable the external module and set the property defaults:
"content": {
"modulesContent": {
"$edgeAgent": {
"properties.desired.modules.externalModule1": {
"settings": {
"image": "123.azurecr.io/externalModule1:0.1.12",
"createOptions": "{\"NetworkingConfig\":{\"EndpointsConfig\":{\"host\":{}}},\"HostConfig\":{\"NetworkMode\":\"host\",\"LogConfig\":{\"Type\":\"json-file\",\"Config\":{\"max-size\":\"10m\",\"max-file\":\"3\"}}}}"
},
"type": "docker",
"status": "running",
"restartPolicy": "always",
"version": "1.0"
}
},
"externalModule1": {
"properties.desired": {
"MaxChargePower": 5000,
"MaxDischargePower": 10000
}
}
}
}
}
Example of the layered deployment to set the device specific values:
{
"content": {
"modulesContent": {
"$edgeAgent": {},
"externalModule1": {
"properties.desired.MaxChargePower": 6000,
"properties.desired.MaxDischargePower": 15000,
"properties.desired.iotpool_account": {
"iotpool_id" : "<insert iotpool id>",
"iotpool_password" : "<insert iotpool password>",
"cert" : "<insert cert>",
"key" : "<insert key>"
}
}
}
}
}