Skip to content

Latest commit

 

History

History
75 lines (49 loc) · 2.1 KB

README.md

File metadata and controls

75 lines (49 loc) · 2.1 KB

IoT Edge Demo

Delivery of code to remote devices using Azure IoT Edge.

Getting started

Create the infraestructure:

# Setup
az extension add --name azure-iot
az group create --name edge --location eastus2

# VM
# Set the auto-shutdown using the portal, not available in Azure CLI
az vm image terms accept --urn microsoft_iot_edge:iot_edge_vm_ubuntu:ubuntu_1604_edgeruntimeonly:latest
az vm create --resource-group edge --name EdgeVM --image microsoft_iot_edge:iot_edge_vm_ubuntu:ubuntu_1604_edgeruntimeonly:latest --admin-username azureuser --generate-ssh-keys

# IoT Hub
az iot hub create --resource-group edge --name {hub_name} --sku F1 --partition-count 2
az iot hub device-identity create --hub-name {hub_name} --device-id myEdgeDevice --edge-enabled
az iot hub device-identity show-connection-string --device-id myEdgeDevice --hub-name {hub_name}

# Replace {device_connection_string} with the connection string
az vm run-command invoke -g edge -n EdgeVM --command-id RunShellScript --script "/etc/iotedge/configedge.sh '{device_connection_string}'"

Manage the device:

# Test the IoT Edge runtime
ssh azureuser@{publicIpAddress}
sudo systemctl status iotedge

# If you need to troubleshoot the service, retrieve the service logs.
journalctl -u iotedge

# View the modules running on your device.
sudo iotedge list

# Check the runtime
sudo iotedge check

If you run error 417 -- The device's deployment configuration is not set don't worry, check this issue.

Modules

To create modules on top of this infrastructure, check modules directory.

  • EdgeModule - A simple module
  • EdgeModuleCSharp - A custom code module

Admin commands

Turning off your VM to avoid costs:

az vm deallocate -g edge -n EdgeVM

Deleting the resource group:

az group delete -n edge

References

Quick start Linux

How to install IoT Edge on Linux