title | description | services | keywords | author | manager | ms.author | ms.date | ms.topic | ms.service |
---|---|---|---|---|---|---|---|---|---|
Quickstart Azure IoT Edge + Windows | Microsoft Docs |
Try out Azure IoT Edge by running analytics on a simulated edge device |
iot-edge |
kgremban |
timlt |
kgremban |
11/15/2017 |
article |
iot-edge |
In this quickstart, use the Azure IoT Edge cloud interface to deploy prebuilt code remotely to an IoT Edge device. To accomplish this task, first use your Windows device to simulate an IoT Edge device, then you can deploy a module to it.
If you don't have an active Azure subscription, create a free account before you begin.
This tutorial assumes that you're using a computer or virtual machine running Windows to simulate an Internet of Things device. If you're running Windows in a virtual machine, enable nested virtualization and allocate at least 2GB memory.
-
Make sure you're using a supported Windows version:
- Windows 10
- Windows Server
-
Install Docker for Windows and make sure it's running.
-
Install Python 2.7 on Windows and make sure you can use the pip command.
-
Run the following command to download the IoT Edge control script.
pip install -U azure-iot-edge-runtime-ctl
Note
Azure IoT Edge can run either Windows containers or Linux containers. To use Windows containers, you have to run:
- Windows 10 Fall Creators Update, or
- Windows Server 1709 (Build 16299), or
- Windows IoT Core (Build 16299) on a x64-based device
For Windows IoT Core, follow the instructions in Install the IoT Edge runtime on Windows IoT Core. Otherwise, simply configure Docker to use Windows containers, and optionally validate your prerequisites with the following powershell command:
Invoke-Expression (Invoke-WebRequest -useb https://aka.ms/iotedgewin)
Create an IoT hub in your Azure subscription. The free level of IoT Hub works for this quickstart. If you've used IoT Hub in the past and already have a free hub created, you can skip this section and go on to Register an IoT Edge device. Each subscription can only have one free IoT hub.
-
Sign in to the Azure portal.
-
Select the Cloud Shell button.
-
Create a resource group. The following code creates a resource group called IoTEdge in the West US region:
az group create --name IoTEdge --location westus
-
Create an IoT hub in your new resource group. The following code creates a free F1 hub called MyIotHub in the resource group IoTEdge:
az iot hub create --resource-group IoTEdge --name MyIotHub --sku F1
[!INCLUDE iot-edge-register-device]
The IoT Edge runtime is deployed on all IoT Edge devices. It comprises two modules. First, the IoT Edge agent facilitates deployment and monitoring of modules on the IoT Edge device. Second, the IoT Edge hub manages communications between modules on the IoT Edge device, and between the device and IoT Hub.
Configure the runtime with your IoT Edge device connection string from the previous section.
iotedgectl setup --connection-string "{device connection string}" --auto-cert-gen-force-no-passwords
Start the runtime.
iotedgectl start
Check Docker to see that the IoT Edge agent is running as a module.
docker ps
[!INCLUDE iot-edge-deploy-module]
In this quickstart, you created a new IoT Edge device and installed the IoT Edge runtime on it. Then, you used the Azure portal to push an IoT Edge module to run on the device without having to make changes to the device itself. In this case, the module that you pushed creates environmental data that you can use for the tutorials.
Open the command prompt on the computer running your simulated device again. Confirm that the module deployed from the cloud is running on your IoT Edge device.
docker ps
View the messages being sent from the tempSensor module to the cloud.
docker logs -f tempSensor
You can also view the telemetry the device is sending by using the IoT Hub explorer tool.
When you no longer need the IoT Hub you created, you can use the az iot hub delete command to remove the resource and any devices associated with it:
az iot hub delete --name {your iot hub name} --resource-group {your resource group name}
You learned how to deploy an IoT Edge module to an IoT Edge device. Now try deploying different types of Azure services as modules, so that you can analyze data at the edge.