0

What is best practice to update the device twin desired properties for multiple (1000+) devices?

Is a batchjob the correct way to go?

Peter
  • 174
  • 8

2 Answers2

0

Other option for updating a multiple (1000+) devices is to use an export/import devices bulk operations, see more details here.

Update:

I do recommend to read a Reference - IoT Hub quotas and throttling related to the limits and Updating a large number of device identities.

Besides that, the export/import devices bulk operations allows to use a stream job for analyzing all devices and creating an import blob for their updating. Also, the import bulk operation is only way to update a reported properties in the cloud backend, if it is necessary.

Note, that the import bulk operation job generates an importErrors.log blob with a detail info for error message per each device update.

Roman Kiss
  • 7,925
  • 1
  • 8
  • 21
  • Yes, @Peter. As in the document you linked, a *scheduledUpdateTwin* job is used to update a set of desired properties or tags. And Roman Kiss's suggestion is indeed another available option for that. – Michael Xu Jun 12 '18 at 06:26
  • Thank you both. @Michael how will a job handle the throttling with a device query like "deviceId IN ['MyDevice1','MyDevice2', ......+ 100 devices]"? – Peter Jun 12 '18 at 07:57
  • @Peter, if you use HTTPS 1.1 request for updating device twin properties on a set of devices using a job, you can set `queryCondition` in the request.The query condition can also be on a single device ID or on a list of device IDs as `queryCondition: 'deviceId IN ['MyDevice1','MyDevice2', ....... + 100 devices]'`. If you use node.js as back end to schedule jobs for updating a device twin's properties, you can refer to this [document](https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-node-node-schedule-jobs#schedule-jobs-for-calling-a-direct-method-and-updating-a-device-twins-properties). – Michael Xu Jun 12 '18 at 08:17
0

You can use Automatic Device Configuration to update and monitor twin changes for a large number of devices.

Yi Zhong - MSFT
  • 306
  • 2
  • 7