
Explanation:
Run the following command in the command-line environment where you are using the Azure CLI to install the IoT extension:
Step 1: az extension add
--name <iot-extension-name>
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 <iot-hub-name>
--device-id <device-id>
Create a new device in the IoT Hub "DemoHub"
Command: az iot hub device-identity create --hub-name DemoHub --device-id testDevice Step 3: az iot hub device-identity show-connection-string
--hub-name { iot-hub-name }
--device-id <device-id>
References:
https://github.com/MicrosoftDocs/azure-docs/blob/master/includes/iot-hub-get-started-create-device-identity.md