
Explanation:
Step 1: az extension add --name azure-cli-iot-ext
Run the following command in the command-line environment where you are using the Azure CLI to install the IoT extension:
az extension add --name azure-cli-iot-ext
Step 2: az iot hub device-identity create
--hub-name {Hub01}
--device-id Sensor00
Create a new device identity called myDeviceId and retrieve the device connection string with these commands:
az iot hub device-identity create --device-id myDeviceId --hub-name {Your IoT Hub name} az iot hub device-identity show-connection-string --device-id myDeviceId --hub-name {Your IoT Hub name} -o table Step 3: az iot hub device-identity show-connection-string
--hub-name {Hub01}
--device-id Sensor00
--output table
Step 4:
Create the service app
In this section, you create a Node.js console app that adds location metadata to the device twin.
npm install azure-iothub --save
References:
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-node-node-twin-getstarted