Exercise 2: Provisioning an IoT Hub
Provisioning an IoT Hub and enrolling a single device are automated with the Azure CLI in the following exercise. The commands from the exercise should be completed in bash. The script’s output should provide the connection string for the virtual device. The connection string should be persisted so that you can configure the following exercise: https://packt.link/RuG8K.
Note
The following commands should be executed in bash. Use Cloud Shell or install the Azure CLI at http://aka.ms/azcli locally. The output and resources will be used for the next exercise.
- Install the Azure CLI, and add the necessary extensions for the IoT and Stream Analytics functionalities:
az extension add --upgrade -n azure-iot
az extension add --upgrade -n stream-analytics
- Create a resource group:
az group create -l eastus -n IoTHubDemo-RG
- Generate unique names and create an IoT hub:
iothub=msg$RANDOM
az iot hub create --name $iothub --resource-group...