title | description | services | author | ms.service | ms.topic | ms.date | ms.author | ms.custom |
---|---|---|---|---|---|---|---|---|
include file |
include file |
iot-hub |
dominicbetts |
iot-hub |
include |
09/07/2018 |
dobett |
include file |
In this section, you use the Azure CLI to create a device identity for this tutorial. The Azure CLI is preinstalled in the Azure Cloud Shell, or you can install it locally. Device IDs are case sensitive.
-
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
-
If you are running the Azure CLI locally, use the following command to sign in to your Azure account (if you are using the Cloud Shell, you are signed in automatically and you don't need to run this command):
az login
-
Finally, 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
[!INCLUDE iot-hub-pii-note-naming-device]
Make a note of the device connection string from the result. This device connection string is used by the device app to connect to your IoT Hub as a device.