Internet of Things(IoT) Hand book
IoT Hand book is a quick reference to all things related to design and development of the IoT solutions specifically on Microsoft eco system (Azure).
In the recent years, organizations have shifted their focus more on IoT adoption and usage. This shift is due to the technology progress and maturity in terms of the hardware sensors, devices and software, improved connectivity over cellular network, production ready hardware and even the ability to run the IoT solutions at the edge.
Today we have tremendous development tooling, cloud and edge computing options to build richer IoT solutions. The handbook provides some solution, tips & tricks, cheat sheets and reference to Microsoft.
Solutions
IoT Hub - Create/Delete & Properties display
IoT Hub - Create
az iot hub create --name <iothubName> -resource-group <resourceGroupName> \
--sku <skuname>
For tier and pricing information refer to documentation.
IoT Hub - Delete
az iot hub delete --name <iothubName> -resource-group <resourceGroupName>
IoT Hub - Properties Display
az iot hub show --query properties.eventHubEndpoints.events.endpoint \
--name <iothubName>
az iot hub show --query properties.eventHubEndpoints.events.path \
--name <iothubName>
az iot hub policy show --name service --query primaryKey \
--hub-name <iothubName>
Display the primary connection string
az iot hub show-connection-string --name <iothubName> \
--key primary --query connectionString -o tsv
IoT Hub - Retrieving Iot Hub Connection String (Backend Apps)
az iot hub show-connection-string --policy-name service \
--name <iothubName> --output table
Generate Iot Hub SAS Token
az iot hub generate-sas-token --device-id MyTestDevice --hub-name {YourIoTHubName}
IoT Hub - Device Registration/Connect
IoT Hub - Registering a Device
az iot hub device-identity create \
--hub-name <iothubName> --device-id <devicename>
IoT Hub - Displaying a Connection String of the Device
az iot hub device-identity show-connection-string \
--hub-name <iothubName> --device-id <devicename> --output table
IoT Hub - Monitor
az iot hub monitor-events --output table --hub-name <iothubName>
IoT Hub - IP Filter Rules
IoT Hub - Retrieve current IP filters
az resource show -n <iothubName> -g <resourceGroupName> --resource-type Microsoft.Devices/IotHubs
IoT Hub - Add IP filters
az resource update -n <iothubName> -g <resourceGroupName> \
--resource-type Microsoft.Devices/IotHubs \
--add properties.ipFilterRules "{\"action\":\"Reject\",\"filterName\":\"MaliciousIP\",\"ipMask\":\"6.6.6.6/6\"}"
IoT Hub - Delete IP filters
az resource update -n <iothubName> -g <resourceGroupName> \
--resource-type Microsoft.Devices/IotHubs \
--add properties.ipFilterRules <ipFilterIndexToRemove>
Routing
Create the route for the storage endpoint
az iot hub route create \
--name $routeName \
--hub-name $iotHubName \
--source devicemessages \
--resource-group $resourceGroup \
--endpoint-name $endpointName \
--enabled \
--condition $condition
DPS
Linking DPS and IoT Hub
az iot dps linked-hub create --dps-name <dpsname> \
--resource-group <resourceGroupName> \
--connection-string <hubConnectionString> --location <location>
Detailed Commands
VS Code Extensions
Azure IoT Tools extensions installs all the IoT related extensions such as IoT Hub Toolkit, IoT Edg, IoT Device Workbench, IoT Services
Alternatively you could install the IoT related extension individually
Azure CLI
Following are the extensions available
IoT DevOps
- IoT Edge tasks for Azure pipelines
- IoT Edge Jenkins Plugin
- Azure DevOps project for IoT Edge
General
- IoT End to End Solutions
- Iot Hub - Azure Monitoring Reference
- X.509 Certificates and IoT Hub
- IoT Handbook
- IoT Connectivity Troubleshooting
- Open Platform Communication Standars
- Generating Certificates
IoT Edge
- Deep Dive: Building IoT and Iot Edge Solutions with IoT Central
- Deep Dive: Deploying IoT Edge Workloads on Kubernetes
- Using Edge as a gateway Device
- How to create transparent Gateway