DEV Community

Chris McKelt
Chris McKelt

Posted on • Originally published at on

Azure IoT Edge - dotnet, node python


Part 1 - dotnet vs python vs node - temperature emission - who is cooler?

Part 2 - Developing modules
Part 3 - Custom Containers using Apache Nifi
Part 4 - Custom Module using TimescaleDB
Part 5 - Custom Module using Grafana


This code will run through creating an end to end demo of building & deploying an Azure IoT Edge solution.

Code for this example lives here

Whats the demo?

This solution demonstrates an air-conditioning monitoring system where 3 room sensors are publishing their temperature over time.   When a room gets too hot the air conditioner for that room is turned on. Once the room is cooled it is turned off.

Three ‘data generator’ modules publish a message with the following properties.

  • Timestamp 
  • Temperature –   room temp in Celsius
  • IsAirConditionerOn – true/false
  • TagKey – room name (in this case  dotnet, node, python)

Three ‘data recorder’ modules subscribe to the published temperature messages and save the data in a time series database.

A custom module will listen to all temperature messages and analyse when a room is too hot. Sending a message to turn the rooms air conditioner on.

Demo Focus Areas

  1. show local debug/development options &  remote/real deployment
  2. how to create and configure an Azure IOT Hub environment in Azure using Azure CLI scripts
  3. coding custom modules in .Net, Python, NodeJS (sorry Java)
  4. using existing Azure IoT Edge marketplace modules
  5. using non-edge marketplace modules (docker images) to save data with Timescale
  6. connecting a data flow engine ( Apache Nifi) to the Edge MQTT Broker
  7. viewing the data through a Grafana dashboard.

Getting started

In order to develop solutions for the edge:

  1. Read Developing custom modules
  2. Setup your machine using the Azure IoT EdgeHub Dev Tool
  3. I recommend installing these VS code extensions
  4. I recommend using Portainer for docker management both locally & on the deployed edge solution
Portainer running on http://localhost:9000/

Solution Overview

Azure Setup

You will need an Azure IoT Hub setup in Azure.   For this demo I am using the free tier

The IoT Hub Free Edition is intended to encourage proof of concept projects. It enables you to transmit up to a total of 8,000 messages per day, and register up to 500 device identities. The device identity limit is only present for the Free Edition.

To build the environment I have used the Azure CLI and created scripts found here.   Run the top 3 on your selected subscription to create the artefacts in Azure below:


The code contains the docker build files , code & scripts to create the following modules


Descriptions of folders and files

Folder /  File Description
config automatically generate files from the deployment.templates.json (debug or prod) that are used to deploy the solution
modules custom code, docker images for your IOT Edge solution
scripts code to create the environment, build the code/docker images and deploy the solution
tools certificate generator and other tools for solution support
.env holds environment variables that populate the generated config files from the templates
deployment.debug.template.json   creates a file in the /config folder called 'deployment.debug.json' that populates environment variables, used for local development creates a file in the /config folder called '' that populates environment variables, used for production like deployment

Solution Structure Overview

Azure IOT Edge Devices

The solution used 3 devices which will be setup in a future post.

1. Local Simulator

A simulated local environment using the Azure IoT Edge Hub Development simulator to run against the IOT Hub.   When developing for the edge it is recommended not to install the real ‘IOT edge runtime’ on your machine but instead use the simulator.

2. Local Device

Linux Ubuntu machine hosted in VMWare on my local machine using Hyper V

3. Cloud Device

Linux Ubuntu hosted on Azure in our resource group created using this script

This uses the pre-existing Linux Ubuntu image from the Azure Marketplace  with the runtime installed.

Once up and running VS Code will show the devices below.



Now we have a view of the setup, development environment & code, we can move onto the next post ‘Developing custom modules for Azure IoT Edge'

Top comments (2)

_ceder profile image
Christian Eder

Hi @chris_mckelt ,

thanks for the article! I'm curious about your recommendation to use Portainer for docker management. I haven't used Portainer yet, only recently heard of it, so I'm not sure what benefits it brings in terms of managing the deployment of containers to the edge device fleet, as opposed to using Azure IoT Edge & IoT Hub for that aspect.

Also, since you wrote this article a while ago, do you have some learnings or experiences to share regarding this aspect, both positive and negative?


chris_mckelt profile image
Chris McKelt

Hi @_ceder, apologies for the late reply :) I still love Portainer and think it's great to accompany a deployment of containers to help debug & view what is going on. Right now, I use a Dev Container that hosts my development environment. Inside that, I use Docker Compose to spin up multiple containers. Locally I can use VSCode's Docker extension to inspect containers. However, I still use Portainer for its UI when required. When deployed to the cloud I like to use Portainer to inspect and debug my containers. It's a personal preference and I am always searching for a better way. I hope that answers your question! Thanks for your comment :)