You'll create an Azure VM with IoT Edge installed.
You'll need Azure Cloud Shell for this lab with an active Azure subscription.
Perform the following steps in the Azure Cloud Shell environment.
az extension add --name azure-cli-iot-ext
Perform these steps in the cloud shell environment.
az iot hub create \
--resource-group iotlab-resources-$UNIQUESTRING \
--name iotlab-hub-$UNIQUESTRING \
--sku S1 \
--partition-count 2
az iot hub device-identity create \
--hub-name iotlab-hub-$UNIQUESTRING \
--device-id edge-device-$UNIQUESTRING \
--edge-enabled
Configure a sample set of inter-communicating modules as the workload to run on the device
# Download
wget https://aka.ms/iotsummit/sampleWorkload \
-O workload.json -q
# Set
az iot edge set-modules \
--hub-name iotlab-hub-$UNIQUESTRING \
--device-id edge-device-$UNIQUESTRING \
--content workload.json
Perform these steps in the cloud shell environment.
ssh-keygen -m PEM -t rsa -b 4096 -q -f ~/.ssh/id_lab -N ""
# Set environment variable
export CONNSTR=$(az iot hub device-identity show-connection-string \
--device-id edge-device-$UNIQUESTRING \
--hub-name iotlab-hub-$UNIQUESTRING \
-o tsv)
# Deploy VM
az group deployment create \
--name edgeVm \
--resource-group iotlab-resources-$UNIQUESTRING \
--template-uri "https://aka.ms/iotsummit/labVmDeploy" \
--parameters location=$RGLOC \
--parameters dnsLabelPrefix=iotedge-vm-$UNIQUESTRING \
--parameters adminUsername='azureuser' \
--parameters deviceConnectionString=$CONNSTR \
--parameters authenticationType='sshPublicKey' \
--parameters adminPasswordOrKey="$(< ~/.ssh/id_lab.pub)" | \
jq .properties.outputs
ssh -i ~/.ssh/id_lab azureuser@iotedge-vm-xyz.westus2.cloudapp.azure.com
.watch sudo iotedge list
in the VM's bash shell and wait for it report modules as running. It is expected to see "command not found" initially. Ctrl+c
returns you to the VM's shell.exit
in the VM's SSH shell to return the cloud shell environmentCongratulations! You've completed the first lab, we'll use this VM for most other labs in the workshop. We recommend tackling the IoT Edge Troubleshooting Tools labs next.