Skip to content

Latest commit

 

History

History
95 lines (55 loc) · 3.13 KB

readme.md

File metadata and controls

95 lines (55 loc) · 3.13 KB

Add an Edge Module and Deploy to Edge Device

Overview

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.

Steps

In the Azure portal

  • Navigate to your IoT hub.

  • Go to IoT Edge under Automatic Device Management and select your IoT Edge device.

  • Select Set Modules.

A three-step wizard opens in the portal, which guides you through

* adding modules,
* specifying routes, and
* reviewing the deployment.

Under Explorer select IoT Edge and select Edge Device Edge Device

Click on Set Modules

Set Modules

In the Add Modules step of the wizard, find the Deployment Modules section. Click Add then select IoT Edge Module.

Add Edge Module

Use the Temperature Sensor Simulator pre-built module.

In the Name field, enter tempsensor.

In the Image URI field, enter mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0.

Leave the other settings unchanged, and select Save.

Note: Module will send 500 messages, you will have to restart the module to resend the messages. You can add an envirnment variable MessageCount to the number of messages that should be sent (set it to -1 to send unlimited messages)

Temp Sensor

In the Specify Routes step of the wizard, you should have a default route that sends all messages from all modules to IoT Hub. If not, add the following code then Click Next

Modules Runing

{
    "routes": {
        "route": "FROM /messages/* INTO $upstream"
    }
}

In the Review Deployment step of the wizard, select Submit.

routes

Click Submit

Submit

Return to the device details page and select Refresh.

In addition to the edgeAgent module that was created when you first started the service, you should see another runtime module called edgeHub and the tempSensor module listed.

It may take a few minutes for the new modules to show up. The IoT Edge device has to retrieve its new deployment information from the cloud, start the containers, and then report its new status back to IoT Hub.

modules

SSH into Linux VM and list the modules. You will see the 3 modules deployed on to the edge device. Use command

iotedge list

modules

Look at tempSensor module logs, you will see telemetry being sent to the cloud

iotedge logs tempsensor

telemetry

Note: tempsensor module will stop sending messages after 500 messages have been sent. You can restart it using the following command:

```shell
iotedge restart tempsensor
```