You are on page 1of 13

Andam, Renzylyn O.

COE 191

Azure IoT Edge brings compute capability closer to the source of the data, that is, to edge devices. IoT Edge provides the
ability to move workloads from the cloud to the edge. In doing so, IoT Edge overcomes the problems of latency and
response times.

The ability to move computing workloads to edge devices provides other advantages such as deploying artificial
intelligence applications on edge devices. Machine learning models can be trained in the cloud and then deployed on
edge devices. IoT Edge also provides the ability to run in offline mode and provides the underlying security for reliable
operations in such cases.

Azure IoT Edge is a combination of a cloud service running in the cloud and a runtime that runs on the device. The
runtime starts and manages workflows on the device. The workflow comprises a set of containers that you link together
in a specific order to create an end-to-end scenario. IoT Edge is managed by the IoT Hub. The Azure IoT Edge enables
you to run workloads on the edge device, which are developed using cloud services. The workload is a module deployed
using docker compatible containers. The modules could be artificial intelligence applications, Azure and third-party
services, or your business logic.

IoT Edge enables you to:

 React in near real time to local changes


 Manage edge devices
 Deploy using Containers
 Deploy using secure and certified hardware
 Distribute AI and analytics workloads to the edge
 Use existing developer skillsets and code
 Manage data to reduce costs
 Reliably operate in offline or intermittent mode
 Provide security for edge deployments
 Ensure privacy for IoT deployments
 Act as a gateway
 Availability of third-party modules

Azure IoT Edge comprises three components:

 IoT Edge modules are units of execution implemented as Docker compatible containers. IoT Edge modules can
run business logic at the edge. IoT Edge modules can run Azure services, third-party services, or your code. if
needed.

 IoT Edge runtime runs on each IoT Edge device and manages the runtime and communication for the modules
deployed to each device. IoT Edge runtime ensures that the modules are always running and report module
health to the cloud.

The runtime performs several functions such as:

 Installing and updating workloads


 Maintaining IoT Edge security standards
 Managing communication between downstream leaf devices and the IoT Edge device
 Managing communication between modules on an IoT Edge device and managing communications between an
IoT Edge device and the cloud.
workload

 IoT Edge cloud interface enables you to monitor and manage IoT Edge devices remotely
 IoT Edge modules are executable packages implemented as containers.

Through IoT Edge modules, you can deploy cloud workloads to run directly on IoT devices. IoT Edge modules are the
smallest computation units managed by IoT Edge. Using IoT Edge modules, you can analyze data on devices instead of
the cloud. By moving parts of your workload to the edge, your devices can spend less time sending messages to the
cloud and react more quickly to events.

Pre-built IoT Edge Modules are accessed through the Azure Marketplace, where third-party publishers can make their
modules available. The module you deploy simulates a sensor. It sends generated data back to the IoT Hub. You can use
the simulated data for development and testing your IoT solution.

 Set up communication between IoT Hub and IoT Edge


 Define the resource group or use an existing one.
 Create an Azure IoT Edge device.
 Create an Azure IoT Hub or use an existing one.
 Register the IoT Edge device to the IoT Hub.

A resource group is a container to logically group Azure resources. These resources can be, for example, storage
accounts, virtual networks, and virtual machines (VMs) you want to treat as a single entity. The resource group stores
metadata about the resources. Therefore, when you specify a location for the resource group, you're selecting where
that metadata is stored. 

Create an Azure IoT Edge device

IoT Edge devices have the IoT Edge runtime installed on them. The Azure "IoT Edge on Ubuntu" virtual machine is an IoT
device ready for use.

IoT Edge security daemon: starts each time an IoT Edge device boots and bootstraps the device by running the IoT Edge
agent.

IoT Edge agent: facilitates deployment and monitoring of modules on the IoT Edge device, including the IoT Edge hub.

IoT Edge hub: manages communications between modules on the IoT Edge device and between the device and IoT Hub.

Create an IoT Hub

Azure IoT Hub enables the communication between the virtual device and the cloud. To create a new Azure IoT Hub
with the Azure CLI, you'll use the az IoT hub create command set.

Register the IoT Edge device to IoT Hub

Use the az IoT hub device-identity create command to create a device identity for your Edge device on Azure. The device
identity enables you to communicate with your IoT Hub.

Retrieve the connection string with the az iot hub device-identity show-connection-string command. Every device
identity uses a unique device connection string to associate it with a physical device.

Set up the connection string on the IoT Edge device so it can connect to the IoT Hub. You can do this remotely without
connection to the virtual machine by running a script on the device. Use the az vm run-command to invoke a script on
the edge device and pass the connection string as a parameter.
Ensure the IoT Edge device is ready to run pre-built modules

Once the edge device is configured, check if it is ready to run a pre-built module.

Log on to the edge device using the public IP address for the device and run the ssh command.

With iotedge commands, you can check if the IoT Edge security daemon is running as a system service.

Exercise - Set up communication between IoT Hub and IoT Edge

This exercise uses Azure CLI in Azure Cloud Shell to issue the required commands. To get started,
open https://shell.azure.com.

Install Azure IoT extension

You need to add Edge Azure IoT extension to the Cloud Shell instance Azure CLI. First, check which extensions you
already have installed by running the following command:

Azure CLICopy

az extension list

If the older version of the Azure IoT extension named azure-cli-iot-ext is installed, remove it. This version is incompatible
with the current version. To remove the extension, run this command:

Azure CLICopy

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

Install the current Azure IoT extension:

Azure CLICopy

az extension add --name azure-iot

Create a resource group

Create a resource group called "IoTEdgeResources" using the following command:

Azure CLICopy

az group create --name IoTEdgeResources

Create a virtual machine to act as your device

Accept the terms of use and create the Microsoft-provided Azure IoT Edge on Ubuntu virtual machine. This virtual
machine preinstalls everything you need to run IoT Edge on a device.

Accept license terms

To accept the license terms, run this command:

Azure CLICopy

az vm image accept-terms --urn

Deploy a prebuilt module to an IoT Edge device


Two steps are required to deploy a pre-built module to an edge device:

Choose an IoT Edge module from the Azure Marketplace

Select the IoT Edge device to receive the module

For our scenario, we want to use a module simulating temperature data.

 Open the marketplace in Azure portal


 Search for the module Simulated Temperature Sensor
 Choose the IoT Edge device to receive this module.

A three-step wizard helps to define the stages to deploy the module.

Add modules: Select the Simulated Temperature Sensor module.

Specify routes: Routing specifies how messages are passed between modules and IoT Hub. In this case, we select all
messages from all modules to go to IoT Hub.

Review Deployment: This allows you to preview the deployment manifest JSON file that defines all the modules
deployed to your IoT Edge device.

What is a deployment manifest?

A deployment manifest is a JSON document that describes which modules to deploy, how data flows between the
modules and the module twins' desired properties. The deployment manifest tells your device which modules to install
and how to configure them to work together. All IoT Edge devices must be configured with a deployment manifest

View generated data

The "Simulated Temperature Sensor" module creates sample data you can use for testing. The module also generates
environment data, i.e., data for the machine and the environment around the machine.

Clean up resources

To avoid changes, delete Azure resources as needed, including the device that you created, the resource group. Ensure

that the resources deleted won't be needed again


. i

You might also like