Installing Azure IoT Edge Device on Windows
How to install and deploy and Azure IoT Edge Device on Windows
This article will guide you through the steps of installing Azure IoT Edge on a Windows PC in. Installing Azure IoT Edge is the first steps to get started with SIA Connect IIoT Edge gateway as an IoT module.
Installation of IoT Edge on Windows
To install Azure IoT edge first step is to download the installer.
All PowerShell commands needs to be run in Elevated mode by running PowerShell as Administrator
- Open Windows PowerShell in Elevated mode
- As IoT Edge runs as a Linux under Windows Hyper-V needs to be enabled (this might restart your PC)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
- Run the following command to install AzureIoTEdge.msi
$msiPath = $([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi'))
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest "https://aka.ms/AzEFLOWMSI_1_4_LTS_X64" -OutFile $msiPath
Start-Process -Wait msiexec -ArgumentList "/i","$([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi'))","/qn"
- The execution policy for the local machine needs to be set as AllSigned
Start-Process -Wait msiexec -ArgumentList "/i","$([io.Path]::Combine($env:TEMP, 'AzureIoTEdge.msi'))","/qn"
- Now create the IoT Edge for Linux in your Windows deployment
Deploy-Eflow
- You might be asked if you want to run software from “this untrusted publisher”, which is Microsoft. Press A to always allow to run software from Microsoft.
- Press Y, for Yes, when you are asked if you agree to the terms of use.
- When asked if you want to send Diagnostic data to Microsoft select if you want to send required data R or optional diagnostic data O. Press R or N
- Installing is taking place and if successfully done you will be met with the following at the end:
[02/27/2024 10:09:40] Deployment successful
OK
Create an IoT Edge device in IoT Hub
Next step is to create the IoT Edge device to be deployed. This step is not necessary if you already have an IoT Edge in yuor Azure IoT Hub.
Login to Azure tenant
Next step is to login to your Azure tenant in order to create an IoT Edge device. This can also be done using the Azure portal.
az login --scope https://management.core.windows.net//.default
If you are using a different directory select the proper directory to login to:
az login --tenant AZURE_DIRECTORY.onmicrosoft.com
where AZURE_DIRECTORY
is the name of your Azure directory where you hold the subscription to create your IoT Edge.
Create an IoT Edge device
az iot hub device-identity create --device-id IOT_EDGE_NAME --edge-enabled --hub-name IOT_HUB
where IOT_EDGE_NAME
is the name of the IoT Edge device you are about to create and IOT_HUB
is the name of the IoT Hub which the device is going to be created under.
or using the portal by going to IoT Hub → IoT Edge → ➕ Add IoT Edge Device:
Deploy the IoT Edge device
Now the IoT Edge device we just created can be deployed on Windows PC. Find the Connection String for the IoT Edge Device which looks something like HostName=IOT_HUB.azure-devices.net;DeviceId=IOT_EDGE_NAME;SharedAccessKey=LQ2vdt5GOvDUT1ztwi0sRrV554ZK3HBLNAIoEJXR6aU=
Provision the recently installing IoT Edge with the following command:
Provision-EflowVm -provisioningType ManualConnectionString -devConnString "HostName=IOT_HUB.azure-devices.net;DeviceId=IOT_EDGE_NAME;SharedAccessKey=LQ2vdt5GOvDUT1ztwi0sRrV554ZK3HBLNAIoEJXR6aU="
Remember to replace with your own Connection String obtained from the IoT Edge device.
IoT Edge software is not installed and your device is deployed to the installation and you are ready to add SIA Connect as a module.
For next steps read How to deploy SIA Connect as a Azure IoT Edge Device module
Attaching shell to the IoT Edge device
It might become useful to
Connect-EflowVm
and you are now in the bash terminal of the Linux under Windows which run the IoT Edge device.
Getting IP address of IoT Edge
To get the loca IP of the IoT Edge Device run the following command:
Get-EflowVmAddr