Skip to content

Latest commit

 

History

History
156 lines (105 loc) · 6.4 KB

File metadata and controls

156 lines (105 loc) · 6.4 KB
title description services keywords author manager ms.author ms.reviewer ms.date ms.topic ms.service
Simulate Azure IoT Edge on 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
11/16/2017
article
iot-edge

Deploy Azure IoT Edge on a simulated device in Windows - preview

Azure IoT Edge enables you to perform analytics and data processing on your devices, instead of having to push all the data to the cloud. The IoT Edge tutorials demonstrate how to deploy different types of modules, built from Azure services or custom code, but first you need a device to test.

In this tutorial you learn how to:

  1. Create an IoT Hub
  2. Register an IoT Edge device
  3. Start the IoT Edge runtime
  4. Deploy a module

Tutorial architecture

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.

Tip

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

  1. Make sure you're using a supported Windows version:

    • Windows 10
    • Windows Server
  2. Install Docker for Windows and make sure it's running.

  3. Install Python 2.7 on Windows and make sure you can use the pip command.

  4. 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. If you're running one of the following Windows versions, you can use Windows containers:

  • Windows 10 Fall Creators Update
  • Windows Server 1709 (Build 16299)
  • 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. Use the following command to validate your prerequisites:

Invoke-Expression (Invoke-WebRequest -useb https://aka.ms/iotedgewin)

Create an IoT hub

Start the tutorial by creating your IoT Hub. Create IoT Hub

[!INCLUDE iot-hub-create-hub]

Register an IoT Edge device

Register an IoT Edge device with your newly created IoT Hub. Register a device

[!INCLUDE iot-edge-register-device]

Configure the IoT Edge runtime

Install and start the Azure IoT Edge runtime on your device. Register a device

The IoT Edge runtime is deployed on all IoT Edge devices. It comprises two modules. The IoT Edge agent facilitates deployment and monitoring of modules on the IoT Edge device. The IoT Edge hub manages communications between modules on the IoT Edge device, and between the device and IoT Hub. When you configure the runtime on your new device, only the IoT Edge agent will start at first. The IoT Edge hub comes later when you deploy a module.

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

See edgeAgent in Docker

Deploy a module

Manage your Azure IoT Edge device from the cloud to deploy a module which will send telemetry data to IoT Hub. Register a device

[!INCLUDE iot-edge-deploy-module]

View generated data

In this tutorial, 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 three modules on your device

View the messages being sent from the tempSensor module to the cloud.

docker logs -f tempSensor

View the data from your module

You can also 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"] Develop and deploy C# code as a module