Skip to content

Latest commit

 

History

History
163 lines (114 loc) · 6.57 KB

File metadata and controls

163 lines (114 loc) · 6.57 KB
title description services keywords author manager ms.author ms.reviewer ms.date ms.topic ms.service
Install Azure IoT Edge - Windows | Microsoft Docs
Install the Azure IoT Edge runtime on a simulated device in Windows and deploy your first module
iot-edge
kgremban
timlt
kgremban
elioda
10/05/2017
article
iot-edge

Deploy Azure IoT Edge on a simulated device in Windows

Azure IoT Edge moves the power of the cloud to your Internet of Things (IoT) devices. This tutorial walks you through creating a simulated IoT Edge device that generates sensor data. You learn how to:

[!div class="checklist"]

  • Create an IoT hub
  • Register an IoT Edge device
  • Start the IoT Edge runtime
  • Deploy a module
  • View generated data

The simulated device that you create in this tutorial is a monitor on a wind turbine that generates temperature, humidity, and pressure data. You're interested in this data because your turbines perform at different levels of efficiency depending on the weather conditions. The other Azure IoT Edge tutorials build upon the work you do here by deploying modules that analyze the data for business insights.

Prerequisites

This tutorial assumes that you're using a computer or virtual machine running Windows to simulate an Internet of Things device. The following Windows versions are supported:

  • Windows IoT Core (Build 16299) on a x64-based device
  • Windows 10 Fall Creators Update
  • Windows Server 1709 (Build 16299)

Tip

If you're running Windows in a virtual machine, enable nested virtualization and allocate at least 2GB memory.

Docker for Windows can run either Windows containers or Linux containers. The steps for the tutorial are the same regardless of which container type you use, but the software prerequisites are different.

Windows containers in Docker

Run the following command in an Admin PowerShell console to install and configure the prerequisites:

iex (iwr -useb https://aka.ms/iotedgewin)

This script provides the following:

  • Docker, configured to use Windows containers
  • Python 2.7
  • The IoT Edge control tool (iotedgectl.exe)

Linux containers in Docker

Note

During bug bash: Instead of step 1, run the following code:

Download scripts

Extract all

Open cmd in extracted dir

pip install -U .[win32]

  • Run the following command to download the IoT Edge control tool.

    pip install -U azure-iot-edge-runtime-ctl
    

Create an IoT hub

[!INCLUDE iot-hub-create-hub]

Register an IoT Edge device

Create a device identity for your simulated device so that it can communicate with your IoT hub. Since IoT Edge devices behave and can be managed differently than typical IoT devices, you declare this to be an IoT Edge device from the beginning.

  1. In the Azure portal, navigate to your IoT hub.
  2. Select IoT Edge Explorer.
  3. Select Add Edge device.
  4. Give your simulated device a unique device ID.
  5. Confirm that the value of Azure IoT Edge device is set to Yes.
  6. Select Save to add your device.
  7. Select your new device from the list of devices.
  8. Copy the value for Connection string--primary key and save it. You'll use this value to configure the IoT Edge runtime in the next section.

Configure the IoT Edge runtime

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.

Use the following steps to install and start the IoT Edge runtime:

  1. 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
    
  2. Start the runtime.

    iotedgectl start
    
  3. Check Docker to see that the IoT Edge agent is running as a module.

    docker ps
    

Deploy a module

One of the key capabilities of Azure IoT Edge is being able to deploy modules to your IoT Edge devices from the cloud. An IoT Edge module is an executable package implemented as a container. In this section, you deploy a module that generates telemetry for your simulated device.

  1. In the Azure portal, navigate to your IoT hub.

  2. Go to IoT Edge Explorer and select your IoT Edge device.

  3. Select Deploy modules.

  4. Select Add custom IoT Edge module.

  5. In the Name field, enter tempSensor.

  6. In the Image field, enter edgepreview.azurecr.io/azureiotedge/simulated-temperature-sensor:1.0-preview.

  7. Leave the other settings unchanged, and select Save.

  8. Back in the Add modules step, select Next.

  9. In the Specify routes step, select Next.

  10. In the Review template step, select Submit.

  11. Return to the device details page and select Refresh. You should see the new tempSensor module running along the IoT Edge runtime.

    View tempSensor in list of deployed modules

View generated data

You can monitor your new IoT Edge device's status by clicking on it in IoT Edge Explorer page of your IoT hub.

You can view the telemetry the device is sending by using the IoT Hub explorer tool.

Next steps

In this tutorial, you created a new IoT Edge device and used the Azure IoT Edge cloud interface to deploy code onto the device. Now, you have a simulated device generating raw data about its environment.

This tutorial is the prerequisite for all of the other IoT Edge tutorials. You can continue on to any of the other tutorials to learn how Azure IoT Edge can help you turn this data into business insights at the edge.

[!div class="nextstepaction"] Deploy your own code as a module Deploy Azure Stream Analytics as a module