Azure IoT Edge task

Use this task in a build or release pipeline to build, test, and deploy applications quickly and efficiently to Azure IoT Edge.

Container registry types

Azure Container Registry

ParametersDescription
containerregistrytype
Container registry type
(Required) Select Azure Container Registry for ACR or Generic Container Registry for generic registries including Docker hub.
azureSubscriptionEndpoint
Azure subscription
(Required, if containerregistrytype = Azure Container Registry) Select an Azure subscription.
azureContainerRegistry
Azure Container Registry
(Required) Select an Azure Container Registry.

Other container registries

ParametersDescription
containerregistrytype
Container registry type
(Required) Select Azure Container Registry for ACR or Generic Container Registry for generic registries including Docker hub.
dockerRegistryEndpoint
Docker Registry Connection
(Required) Select a generic Docker registry connection. Required for Build and Push

Build module images

ParametersDescription
action
Action
(Required) Select an Azure IoT Edge action.
Default value: Build module images.
templateFilePath
.template.json file
(Required) The path of your Azure IoT Edge solution .template.json file. This file defines the modules and routes in an Azure IoT Edge solution. The filename must end with .template.json.
Default value: deployment.template.json.
defaultPlatform
Default platform
(Required) In your .template.json file you can leave the modules platform unspecified, in which case the default platform will be used.
Default value: amd64.

The following YAML example builds module images:

- task: AzureIoTEdge@2
  displayName: AzureIoTEdge - Build module images
  inputs:
    action: Build module images
    templateFilePath: deployment.template.json
    defaultPlatform: amd64  

Push module images

ParametersDescription
action
Action
(Required) Select an Azure IoT Edge action.
Default value: Build module images.
templateFilePath
.template.json file
(Required) The path of your Azure IoT Edge solution .template.json file. This file defines the modules and routes in an Azure IoT Edge solution. The filename must end with .template.json.
Default value: deployment.template.json.
defaultPlatform
Default platform
(Required) In your .template.json file you can leave the modules platform unspecified, in which case the default platform will be used.
Default value: amd64.
bypassModules
Bypass module(s)
(Optional) Specify the module(s) that you do not need to build or push from the list of module names separated by commas in the .template.json file. For example, if you have two modules, "SampleModule1,SampleModule2" in your file and you want to build or push just SampleModule1, specify SampleModule2 as the bypass module(s). Leave empty to build or push all the modules in .template.json.

The following YAML example pushes module images:

variables:
    azureSubscriptionEndpoint: Contoso
    azureContainerRegistry: contoso.azurecr.io

steps:    
- task: AzureIoTEdge@2
  displayName: AzureIoTEdge - Push module images
  inputs:
    action: Push module images
    containerregistrytype: Azure Container Registry
    azureSubscriptionEndpoint: $(azureSubscriptionEndpoint)
    azureContainerRegistry: $(azureContainerRegistry)
    templateFilePath: deployment.template.json
    defaultPlatform: amd64  

Deploy to IoT Edge devices

ParametersDescription
action
Action
(Required) Select an Azure IoT Edge action.
Default value: Build module images.
deploymentFilePath
Deployment file
(Required) Select the deployment JSON file. If this task is in a release pipeline, you must specify the location of the deployment file within the artifacts (the default value works for most conditions). If this task is in a build pipeline, you must specify the Path of output deployment file.
Default value: $(System.DefaultWorkingDirectory)/*/.json.
connectedServiceNameARM
Azure subscription contains IoT Hub
(Required) Select an Azure subscription that contains an IoT Hub
iothubname
IoT Hub name
(Required) Select the IoT Hub
deviceOption
Choose single/multiple device
(Required) Choose to deploy to a single device, or to multiple devices specified by using tags.
deploymentid
IoT Edge deployment ID
(Required) Enter the IoT Edge Deployment ID. If an ID already exists, it will be overridden. Up to 128 lowercase letters, numbers, and the characters - : + % _ # * ? ! ( ) , = @ ; ' More details.
Default value: $(System.TeamProject)-devops-deployment.
priority
IoT Edge deployment priority
(Required) A positive integer used to resolve deployment conflicts. When a device is targeted by multiple deployments it will use the one with highest priority or, in the case of two deployments with the same priority, the one with the latest creation time.
Default value: 0.
targetcondition
IoT Edge device target condition
(Required) Specify the target condition of the devices to which you want to deploy. For example, tags.building=9 and tags.environment='test'. Do not include double quotes. More details.
deviceId
IoT Edge device ID
(Required) Specify the IoT Edge Device ID.