Azure IoT Edge – Registering a New Device and installing IoT Edge 1.2

I have decided to look at rebuilding my Nvidia Jetson Nano device with the new version of IoT Edge 1.2, as well as taking the opportunity to flash a new 32GB card with a fresh installation of JetPack as the device has become a little messy with my tinkering over the last few months.

Follow the below steps top look at what is involved with getting an IoT Edge device registered and configured with Azure IoT Hub.

Here is my Jetson Nano device OS ready to go, all set up and on the network.

Register Device

With IoT Edge devices we have two options to register, either with symmetric keys, or with X.509 Certificates. For the purposes of this demo, I will be using the symmetric keys created by the IoT Hub.

In order to run through the registration we have to fist create an IoT Edge device within our IoT Hub in our Azure Subscription.

From your IoT Hub select IoT Edge:

Then click on:

Enter a device ID and click on Save:

You will see your device available in the IoT Edge Devices List:

Setup Device Prereqs

Next we need to install the Azure IoT Edge runtime system modules in order that the Jetson Nano can communicate with IoT Hub.

We must first do some prereqs which I will run through via ‘ssh’ onto my Jetson Nano:

Prepare device to access the Microsoft Installation packages:

sudo apt install curl 
curl > ./microsoft-prod.list

Copy the generated list to the sources.list.d directory:

sudo cp ./microsoft-prod.list /etc/apt/sources.list.d/

Install the Microsoft GPG public key:

curl | gpg --dearmor > microsoft.gpg
sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/

Install a container engine:

sudo apt-get update
sudo apt-get install moby-engine

Install IoT Edge

Update packages and check which versions of IoT Edge and IoT Identity are available

sudo apt-get update
apt list -a aziot-edge aziot-identity-service

Install the latest version of IoT Edge and the IoT Identity Service:

sudo apt-get install aziot-edge

Next we will need to provision this device with the symmetric keys created when we registered an IoT Edge device in the IoT Hub earlier.

Create the configuration file by using the template file provided as part of the IoT Edge installation:

sudo cp /etc/aziot/config.toml.edge.template /etc/aziot/config.toml

Open the config file:

sudo apt install nano
sudo nano /etc/aziot/config.toml

Scroll to these lines and paste in your connection string from your IoT Edge configuration in Azure Portal:

Exit from nano using ‘Ctrl + x’

Select Yes to save config.

Finally apply the config:

sudo iotedge config apply

And there we have it! A configured IoT Edge Device.

We could use some of the following commands to verify our configuration:

sudo iotedge system status
sudo iotedge system logs
sudo iotedge check
sudo iotedge list
As an example, we can now see that our edgeAgent Module is running on the device.

Or we could browse to our IoT Edge device in the IoT Hub and check that it can communicate with the device:

Here we can see that our edgeAgent module is running!

I hope you have found this article useful!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s