DEV Community

Cover image for Setup Azure IOT Edge Runtime on the Raspberry Pi - Minified - 1
Rohan Sawant
Rohan Sawant

Posted on

Setup Azure IOT Edge Runtime on the Raspberry Pi - Minified - 1

The official documentation is very verbose and wordy, which is exactly how it should be, but this tutorial tries a more brief approach towards installing the IOT Runtime on the Raspberry Pi


  • You are fairly comfortable with Cloud Service providers, AWS, Azure or GCP.
  • You have worked with the Raspberry Pi and SSH before

You will learn

  1. How to setup Azure IOT Edge using the Portal
  2. How to get a Raspberry Pi communicating with Azure

Key Concepts

Here are some of these explained in laymen's terms

Azure IOT Hub

  • Managed service to enable bi-directional communication between IoT devices and Azure

  • Azure IoT Hub provides a cloud-hosted solution backend to connect virtually any device.

Read More

Azure IOT Edge Device

  • Logical representation, or the identity which the IOT Hub assigns every physical hardware device connected to it.

Azure IOT Runtime

  • Enables custom and cloud logic on IoT Edge devices. The runtime sits on the IoT Edge device, and performs management and communication operations.

Read More

1. Setting up Azure

Creating the Hub

  1. Login to the Azure Portal
  2. Search for 'IOT Hub'
  3. Click Add, under Size and Scale select Free Tier, accept the defaults and create an IOT Hub

Creating the Edge Device

  1. Go to the IOT Hub you just created
  2. From the side panel under Automatic Device Management, click IoT Edge, then click New
  3. Add a device name, accept the defaults and click Save
  4. Refresh, click the Device you just created, unhide and copy the Primary Connection String, keep this handy for later.

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

2. Setting up the Raspberry Pi


  1. Ensure that the Raspberry Pi (RPi) is running Raspbian Stretch
  2. Ensure that Docker and Docker Compose are installed. Read More - Installing Docker and Docker Compose on the Raspberry Pi in 5 Simple Steps

Installing Azure IOT Edge Runtime

1) Registering Microsoft key and software repository feed

   curl > ./microsoft-prod.list
   sudo cp ./microsoft-prod.list /etc/apt/sources.list.d/
   curl | gpg --dearmor > microsoft.gpg
   sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/
Enter fullscreen mode Exit fullscreen mode

2) Installing Moby-Engine, and IOTEdge Runtime

   sudo apt-get update -y
   sudo apt-get install libssl1.0.2 moby-engine moby-cli iotedge -y
Enter fullscreen mode Exit fullscreen mode

3) Let's add the connection string to connect the RPi with Azure

   sudo nano /etc/iotedge/config.yaml
Enter fullscreen mode Exit fullscreen mode

Add the Primary Connection String from Step 1.2 in here, and it should look something like this.

   # Manual provisioning configuration
     source: "manual"
     device_connection_string: ";DeviceId=rpi-1;SharedAccessKey=XXXXc="
Enter fullscreen mode Exit fullscreen mode

4) Setup is done, restart the service.

   sudo systemctl restart iotedge
Enter fullscreen mode Exit fullscreen mode

5) Verify the installation.

   sudo systemctl status iotedge
   sudo iotedge check # should return 1 check as failed 'Edge Hub can bind to ports on host'
   sudo iotedge list # No modules are running
Enter fullscreen mode Exit fullscreen mode

References - Install the Azure IoT Edge runtime on Debian-based Linux systems

In the next tutorial, we will Deploy a Module to Azure IOT Edge Runtime on Linux


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 (1)

eriq9 profile image

Hi, I've got a problem.

  • "Could not sart module edgeAgent caused by: OCI runtime create failed: container with id exists". This appear after "sudo systemctl status iotedge" command.

  • "sudo iotedge check" returned: "config.yaml has correct URIs for daemon mgmt endpoint - Error. Docker: Error response from daemon: csgroups: cgroup mountpoint does not exist: unknown."

  • "sudo iotedge list" returned: Status: stopped.

Can you help me?