0 Comments

Following is a guidance how to set up Raspberry PI from the scratch to working Azure IoT Edge device.

There is a three step-by-step articles.

Lets do it together step-by-step.

Registering the Edge device

Before you can use your IoT devices with Azure IoT Edge, you need to register them with your IoT hub. Once you register a device, you receive a connection string that can be used to set up your device for IoT Edge workloads.

This is all about creating IoT hub in Azure and then creating/registering new IoT Edge device.

Step 1. Create IoT hub in Azure

I assume that you have already Azure subscription. If not you can get one 12 months subscription here for free: https://azure.microsoft.com/en-us/free/

  1. Open Azure portal https://portal.azure.com/
  2. Click “Create new resource

Azure create new resource

3. Enter IoT hub for the search box and click Create

Azure create iot hub

4. Configure IoT hub parameters

  1. Create new resource group, for example “TestGroup”
  2. Select the closest region, I have West Europe
  3. Enter name of your IoT hub, for example IoTHubForTestingPurposes

Azure create iot hub

5. Configure pricing

  1. Open “Size and scale” sheet
  2. Select pricingand scale: “F1: Free tier

Azure iot hub pricing

6. Click “Review + create

Azure iot hub create


Step 2. Create an Edge device

  1. Navigate to your IoT hub
  2. Select IoT Edgefrom the menu
  3. Select Add an IoT Edge device

create azure iot edge device

4. Enter name of your device

5. Leave all other information as default and click Save

create iot edge device


Step 3. Get the device connection string

  1. Openyour IoT Edge device
  2. Click Copy of Primary Connection Stringget the primary connection string


Step 4. Configure the Raspberry device

As you have now IoT Edge device created in Azure IoT hub you can configure your device to connect to the IoT hub.

In previous step you copied the connection string to your clipboard. Now this has to be placed into Edge device. Based this connection string the device knows where is the cloud and cloud knows how to find and connect with the device.

  1. Open PuTTY and connect to your device
  2. Enter following command to open configuration fileconfig.yaml
sudo nano /etc/iotedge/config.yaml

3. Find Manual provisioning section

Find the provisioning configurations of the file and uncomment the Manual provisioning configuration section.

4. Update the value of device_connection_string

Update the value of device_connection_string with the connection string from your IoT Edge device. Make sure any other provisioning sections are commented out.

# Manual provisioning configuration provisioning:
	source: "manual"
	device_connection_string: "HostName=IoTHubForTestingPurposes.azure-devices.net;DeviceId=TestDevice;SharedAccessKey=manynumbersandletters"
# DPS TPM provisioning configuration

5. Save and close the file, CTRL + X, Y, Enter.

  • Close the file: Ctrl + X
  • Do you want to save: Y
  • Exit: Enter

6. Restart your device IoT Edge daemon

sudo systemctl restart iotedge


Congratulation: you have now a working Azure IoT Edge device!

We can start to develop solutions on it but there are some tricky things so I will publish additional guidance's for tips and tricks.

Post comment