Azure IoT Edge for Linux on Windows (EFLOW) with IoT Central

Azure IoT Edge for Linux on Windows (EFLOW) lets you run Azure IoT Edge in a Linux container on your Windows device. In this article, you learn how to provision an EFLOW device and manage it from your IoT Central application.

In this how-to article, you learn how to:

  • Import a device manifest for an IoT Edge device.
  • Create a device template for an IoT Edge device.
  • Create an IoT Edge device in IoT Central.
  • Connect and provision an EFLOW device.

Prerequisites

To complete the steps in this article, you need:

  • An active Azure subscription. If you don't have an Azure subscription, create a free account before you begin.

  • An IoT Central application created from the Custom application template. To learn more, see Create an IoT Central application.

  • A Windows device with the following minimum requirements:

    • Windows 101/11 (Pro, Enterprise, IoT Enterprise) or Windows Server 20191/2022
    • Minimum free memory: 1 GB
    • Minimum free disk space: 10 GB
    • 1 Windows 10 and Windows Server 2019 minimum build 17763 with all current cumulative updates installed.

To follow the steps in this article, download the EnvironmentalSensorManifest.json file to your computer.

Import a deployment manifest

You use a deployment manifest to specify the modules to run on an IoT Edge device. IoT Central manages the deployment manifests for the IoT Edge devices in your solution. To import the deployment manifest for this example:

  1. In your IoT Central application, navigate to Edge manifests.

  2. Select + New. Enter a name such as Environmental Sensor for your deployment manifest, and then upload the EnvironmentalSensorManifest.json file you downloaded previously.

  3. Select Next and then Create.

The example deployment manifest includes a custom module called SimulatedTemperatureSensor.

Add device template

In this section, you create an IoT Central device template for an IoT Edge device. You import an IoT Edge manifest to get started, and then modify the template to add telemetry definitions and views:

Create the device template and import the manifest

  1. Create a device template and choose Azure IoT Edge as the template type.

  2. On the Customize page of the wizard, enter a name such as Environmental Sensor Edge Device for the device template.

  3. On the Review page, select Create.

  4. On the Create a model page, select Custom model.

  5. In the model, select Modules and then Import modules from manifest. Select the Environmental Sensor deployment manifest and then select Import.

  6. Select the management interface in the SimulatedTemperatureSensor module to view the two properties defined in the manifest:

Device template created from IoT Edge manifest.

Add telemetry to the device template

An IoT Edge manifest doesn't define the telemetry a module sends. You add the telemetry definitions to the device template in IoT Central. The SimulatedTemperatureSensor module sends telemetry messages that look like the following JSON:

{
  "machine": {
    "temperature": 75.0,
    "pressure": 40.2
  },
  "ambient": {
    "temperature": 23.0,
    "humidity": 30.0
  },
  "timeCreated": ""
}

To add the telemetry definitions to the device template:

  1. Select the management interface in the Environmental Sensor Edge Device template.

  2. Select + Add capability. Enter machine as the Display name and select the Capability type as Telemetry.

  3. Select Object as the schema type, and then select Define. On the object definition page, add temperature and pressure as attributes of type Double and then select Apply.

  4. Select + Add capability. Enter ambient as the Display name and select the Capability type as Telemetry.

  5. Select Object as the schema type, and then select Define. On the object definition page, add temperature and humidity as attributes of type Double and then select Apply.

  6. Select + Add capability. Enter timeCreated as the Display name and make sure that the Capability type is Telemetry.

  7. Select DateTime as the schema type.

  8. Select Save to update the template.

The management interface now includes the machine, ambient, and timeCreated telemetry types:

Interface with machine and ambient telemetry types.

Add views to template

To enable an operator to view the telemetry from the device, define a view in the device template.

  1. Select Views in the Environmental Sensor Edge Device template.

  2. On the Select to add a new view page, select the Visualizing the device tile.

  3. Change the view name to View IoT Edge device telemetry.

  4. Under Start with devices, select the ambient/temperature, ambient/humidity, machine/humidity, and machine/temperature telemetry types. Then select Add tile.

  5. Select Save to save the View IoT Edge device telemetry view.

Publish the template

Before you can add a device that uses the Environmental Sensor Edge Device template, you must publish the template.

Navigate to the Environmental Sensor Edge Device template and select Publish. On the Publish this device template to the application panel, select Publish to publish the template

Add an IoT Edge device

Before you can connect a device to IoT Central, you must register the device in your application:

  1. In your IoT Central application, navigate to the Devices page and select Environmental Sensor Edge Device in the list of available templates.

  2. Select + New to add a new device from the template.

  3. On the Create new device page, select the Environmental Sensor deployment manifest, and then select Create.

You now have a new device with the status Registered:

New Device.

Get the device credentials

When you deploy the IoT Edge device later in this how-to article, you need the credentials that allow the device to connect to your IoT Central application. To get the device credentials:

  1. On the Device page, select the device you created.

  2. Select Connect.

  3. On the Device connection page, make a note of the ID Scope, the Device ID, and the Primary Key. You use these values later.

  4. Select Close.

You've now finished configuring your IoT Central application to enable an IoT Edge device to connect.

Install and provision an EFLOW device

  1. In an elevated PowerShell session, run each of the following commands to download IoT Edge for Linux on Windows.

    $msiPath = $([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi'))
    $ProgressPreference = 'SilentlyContinue'
    Invoke-WebRequest "https://aka.ms/AzEflowMSI" -OutFile $msiPath
    
  2. Install IoT Edge for Linux on Windows on your device.

    Start-Process -Wait msiexec -ArgumentList "/i","$([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi'))","/qn"
    

    You can specify custom IoT Edge for Linux on Windows installation and VHDX directories by adding INSTALLDIR="<FULLY_QUALIFIED_PATH>" and VHDXDIR="<FULLY_QUALIFIED_PATH>" parameters to the install command.

  3. Create the IoT Edge for Linux on Windows deployment. The deployment creates your Linux VM and installs the IoT Edge runtime for you.

    Deploy-Eflow
    
  4. Use the ID scope, Device ID and the Primary Key you made a note of previously.

  Provision-EflowVm -provisioningType DpsSymmetricKey -scopeId <ID_SCOPE_HERE> -registrationId <DEVCIE_ID_HERE> -symmKey <PRIMARY_KEY_HERE>

To learn about other ways you can deploy and provision an EFLOW device, see Install and provision Azure IoT Edge for Linux on a Windows device.

Go to the Device Details page in your IoT Central application and you can see telemetry flowing from your EFLOW device:

Telemetry from the device.

Clean up resources

If you want to remove the Azure IoT Edge for Linux on Windows installation from your device, use the following commands.

  1. Open Settings on Windows
  2. Select Add or Remove Programs
  3. Select Azure IoT Edge LTS app
  4. Select Uninstall

Next Steps

Now that you've learned how to connect Azure IoT Edge for Linux on Windows (EFLOW) with IoT Central, the suggested next step is to learn how to Connect devices through an IoT Edge transparent gateway.