DEV Community

Rohan Sawant
Rohan Sawant

Posted on

Deploy a Module to Azure IOT Edge Runtime on Linux - Minified - 2

After IOT Edge Hub and Runtime are set up, the next step is to deploy a Module to the Edge Device, and that's exactly what this tutorial is about!
The official documentation is very verbose and wordy, which is exactly how it should be, but this tutorial tries a more brief approach.

Prerequisites

OR

  • You have setup the Azure IOT Hub and the IOT Edge Runtime on a device

  • You have verified that the Edge Device can talk to Azure

You will learn

  1. How to deploy a Module onto the Edge Device from the Azure Portal
  2. How to view the messages sent from the Edge Device to Azure

Key Concepts

Modules - Read More

  • modules are the smallest unit of computation managed by IoT Edge.

  • can contain Azure services (such as Azure Stream Analytics) or your own solution-specific code.

  • modules images exist as container images in a repository.

Working of the Deployment Process - Read More

  1. You tell Azure what Module should be deployed to the Edge Device
  2. Azure tells the Device about it via a configuration json file.
  3. Device reads the json, and pulls the required Modules (container images) from a docker registry

Alt Text

Deploying a Module to IOT Edge Device

1) Sign in to the Azure portal and navigate to your IoT hub from the left pane under Automatic Device Management, select IoT Edge and select the Device you want to deploy to.

2) On the upper bar, select Set Modules, then under IoT Edge Modules, click Add.

3) Select Marketplace Module, search for "Simulated Temperature Sensor", select that, accept the defaults, next, review and create

Alt Text

4) The Device periodically checks Azure for updates and it will automatically deploy the new Module, this might take about 5-10 minutes.

Confirming that the Deploy worked.

1) Wait for the changes to propagate

2) On the terminal on your Edge Device to see list of deployed modules do, sudo iotedge list

3) Ensure that you see 3 modules deployed.

Alt Text
References - Deploy a Module - Quickstart: Deploy your first IoT Edge module to a virtual Linux device

Viewing the Message on Azure IOT Hub

1) Open up the Azure Cli from Azure Portal, you should be already logged in.

2) Install the IOT Hub Extension

   az extension add --name azure-cli-iot-ext

3) View the Logs sent by the Edge Device to Azure

   az iot hub monitor-events -n <NAME-OF-YOUR-HUB>

Alt Text

That's it! You have successfully deployed your first Module from the Azure Portal, via the IOT Hub to the IOT Edge Device!

Note

I know It's frustrating when something works in the tutorial but not when you do it, I would hate if that happened to you. So, please leave a comment, or reach out to me. If any of this does not work for you.

Top comments (0)