Run three devices to show how jobs can be used to run a firmware upgrade on a subset of devices and report status through Device Twins. Assumes you have already created a Azure IoT Hub.
- install
npm i -g iothub-explorer
- Azure Cli 2.0
If on Windows use Bash for Windows or Git Bash to run the commands.
. ./utils/login.sh <iothubowner-constring>
. ./utils/create-policy.sh <iothubname>
. ./utils/create-device.sh ds1
. ./utils/create-device.sh ds2
. ./utils/create-device.sh ds3
node service\tag-device.js <connstring for jobs permissions> ds1 US
node service\tag-device.js <connstring for jobs permissions> ds1 US
node service\tag-device.js <connstring for jobs permissions> ds1 Canada
node app\device.js <connstring ds1> nt
node app\device.js <connstring ds2> nt
node app\device.js <connstring ds3> nt
node service\job-schedule.js <connstring for jobs permissions> US
node service\job-status.js <connstring for jobs permissions>
ornode service\get-job.js <connstring for jobs permissions> <jobid>
Source code has been adapted from samples at https://github.com/Azure/azure-iot-sdk-node/tree/master/device/samples under MIT license