다음을 통해 공유


AzureIoTEdge@2 - Azure IoT Edge v2 작업

이 작업을 사용하여 이미지를 빠르고 효율적으로 Azure IoT Edge에 빌드하고 배포할 수 있습니다.

이 작업은 사용자 지정 변수를 지원합니다. Pipelines에서 변수를 사용하는 방법을 잘 모르는 경우 변수 정의참조하세요.

비고

이 작업은 워크플로 ID 페더레이션 사용하여 Azure Resource Manager 인증을지원하지 않습니다.

구문론

# Azure IoT Edge v2
# Build and deploy an Azure IoT Edge image.
- task: AzureIoTEdge@2
  inputs:
    action: 'Build module images' # 'Build module images' | 'Push module images' | 'Generate deployment manifest' | 'Deploy to IoT Edge devices'. Required. Action. Default: Build module images.
    #deploymentFilePath: '$(System.DefaultWorkingDirectory)/config/deployment.json' # string. Required when action == Deploy to IoT Edge devices. Deployment file. Default: $(System.DefaultWorkingDirectory)/config/deployment.json.
    #azureSubscription: # string. Alias: connectedServiceNameARM. Required when action == Deploy to IoT Edge devices. Azure subscription contains IoT Hub. 
    #iothubname: # string. Required when action == Deploy to IoT Edge devices. IoT Hub name. 
    #deviceOption: # 'Single Device' | 'Multiple Devices'. Required when action == Deploy to IoT Edge devices. Choose single/multiple device. 
    #deviceId: # string. Required when deviceOption == Single Device. IoT Edge device ID. 
    #targetcondition: # string. Required when deviceOption == Multiple Devices. IoT Edge device target condition. 
    #containerregistrytype: 'Azure Container Registry' # 'Azure Container Registry' | 'Generic Container Registry'. Required when action = Push module images. Container registry type. Default: Azure Container Registry.
    #dockerRegistryConnection: # string. Alias: dockerRegistryEndpoint. Required when containerregistrytype = Generic Container Registry. Docker Registry Connection. 
    #azureSubscriptionEndpoint: # string. Optional. Use when containerregistrytype = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Required when containerregistrytype = Azure Container Registry. Azure Container Registry. 
    #templateFilePath: 'deployment.template.json' # string. Required when action = Build module images || action = Push module images || action = Generate deployment manifest. .template.json file. Default: deployment.template.json.
    #defaultPlatform: 'amd64' # 'amd64' | 'windows-amd64' | 'arm32v7' | 'arm64v8'. Required when action = Build module images || action = Push module images || action = Generate deployment manifest. Default platform. Default: amd64.
    #fillRegistryCredential: 'true' # 'true' | 'false'. Required when action = Push module images. Add registry credential to deployment manifest. Default: true.
    #deploymentManifestOutputPath: '$(System.DefaultWorkingDirectory)/config/deployment.json' # string. Required when action == Generate deployment manifest. Output path. Default: $(System.DefaultWorkingDirectory)/config/deployment.json.
    #validateGeneratedDeploymentManifest: 'false' # 'true' | 'false'. Required when action = Generate deployment manifest. Validate the schema of generated deployment manifest. Default: false.
  # Advanced
    #deploymentid: '$(System.TeamProject)-devops-deployment' # string. Required when action = Deploy to IoT Edge devices. IoT Edge deployment ID. Default: $(System.TeamProject)-devops-deployment.
    #priority: '0' # string. Required when action = Deploy to IoT Edge devices. IoT Edge deployment priority. Default: 0.
  # Advanced
    #bypassModules: # string. Optional. Use when action = Push module images. Bypass module(s).
# Azure IoT Edge v2
# Build and deploy an Azure IoT Edge image.
- task: AzureIoTEdge@2
  inputs:
    action: 'Build module images' # 'Build module images' | 'Push module images' | 'Generate deployment manifest' | 'Deploy to IoT Edge devices'. Required. Action. Default: Build module images.
    #deploymentFilePath: '$(System.DefaultWorkingDirectory)/config/deployment.json' # string. Required when action == Deploy to IoT Edge devices. Deployment file. Default: $(System.DefaultWorkingDirectory)/config/deployment.json.
    #azureSubscription: # string. Alias: connectedServiceNameARM. Required when action == Deploy to IoT Edge devices. Azure subscription contains IoT Hub. 
    #iothubname: # string. Required when action == Deploy to IoT Edge devices. IoT Hub name. 
    #deviceOption: # 'Single Device' | 'Multiple Devices'. Required when action == Deploy to IoT Edge devices. Choose single/multiple device. 
    #deviceId: # string. Required when deviceOption == Single Device. IoT Edge device ID. 
    #targetcondition: # string. Required when deviceOption == Multiple Devices. IoT Edge device target condition. 
    #containerregistrytype: 'Azure Container Registry' # 'Azure Container Registry' | 'Generic Container Registry'. Required when action = Push module images. Container registry type. Default: Azure Container Registry.
    #dockerRegistryConnection: # string. Alias: dockerRegistryEndpoint. Required when containerregistrytype = Generic Container Registry. Docker Registry Connection. 
    #azureSubscriptionEndpoint: # string. Optional. Use when containerregistrytype = Azure Container Registry. Azure subscription. 
    #azureContainerRegistry: # string. Required when containerregistrytype = Azure Container Registry. Azure Container Registry. 
    #templateFilePath: 'deployment.template.json' # string. Required when action = Build module images || action = Push module images || action = Generate deployment manifest. .template.json file. Default: deployment.template.json.
    #defaultPlatform: 'amd64' # 'amd64' | 'windows-amd64' | 'arm32v7'. Required when action = Build module images || action = Push module images || action = Generate deployment manifest. Default platform. Default: amd64.
    #fillRegistryCredential: 'true' # 'true' | 'false'. Required when action = Push module images. Add registry credential to deployment manifest. Default: true.
    #deploymentManifestOutputPath: '$(System.DefaultWorkingDirectory)/config/deployment.json' # string. Required when action == Generate deployment manifest. Output path. Default: $(System.DefaultWorkingDirectory)/config/deployment.json.
    #validateGeneratedDeploymentManifest: 'false' # 'true' | 'false'. Required when action = Generate deployment manifest. Validate the schema of generated deployment manifest. Default: false.
  # Advanced
    #deploymentid: '$(System.TeamProject)-devops-deployment' # string. Required when action = Deploy to IoT Edge devices. IoT Edge deployment ID. Default: $(System.TeamProject)-devops-deployment.
    #priority: '0' # string. Required when action = Deploy to IoT Edge devices. IoT Edge deployment priority. Default: 0.
  # Advanced
    #bypassModules: # string. Optional. Use when action = Push module images. Bypass module(s).

입력

action - 작업
string; 필수 사항입니다. 허용되는 값: Build module images, Push module images, Generate deployment manifestDeploy to IoT Edge devices. 기본값은 Build module images입니다.

Azure IoT Edge 작업을 선택합니다.

Build module images 모듈만 빌드합니다(컴파일 오류를 확인하는 데 사용할 수 있음).

Push module images 모듈을 컨테이너 레지스트리에 푸시합니다.

Deploy to IoT Edge devices 생성된 배포 파일을 IoT Hub에 배포합니다. (릴리스 파이프라인에 Deploy 작업을 배치하는 것이 좋습니다.)


deploymentFilePath - 배포 파일
string; action == Deploy to IoT Edge devices때 필요합니다. 기본값은 $(System.DefaultWorkingDirectory)/config/deployment.json입니다.

배포 json 파일을 선택합니다. 이 작업이 release pipeline경우 아티팩트에서 배포 파일의 위치를 설정해야 합니다. (기본값은 대부분의 조건에서 작동합니다.) 이 작업이 빌드 파이프라인에 있는 경우 배포 매니페스트 출력 경로를 지정해야 합니다.


azureSubscription - Azure 구독에 IoT Hub 포함
입력 별칭: connectedServiceNameARM. string; action == Deploy to IoT Edge devices때 필요합니다.

IoT Hub가 포함된 Azure 구독을 선택합니다.


iothubname - IoT Hub 이름
string; action == Deploy to IoT Edge devices때 필요합니다.

IoT Hub를 선택합니다.


deploymentid - IoT Edge 배포 ID
string; action = Deploy to IoT Edge devices때 필요합니다. 기본값은 $(System.TeamProject)-devops-deployment입니다.

IoT Edge 배포 ID를 입력합니다. ID가 이미 있는 경우 재정의됩니다. 여기에는 최대 128개의 소문자와 숫자가 있으며 다음 문자가 허용됩니다. -:+%_#*?!(),=@;'. 자세한 내용은 Azure IoT Edge 배포 참조하세요.


priority - IoT Edge 배포 우선 순위
string; action = Deploy to IoT Edge devices때 필요합니다. 기본값은 0입니다.

배포 충돌을 해결하기 위해 priority 양의 정수로 설정합니다. 이 작업이 여러 배포의 대상으로 지정된 경우 디바이스는 우선 순위가 가장 높은 배포를 사용하거나, 우선 순위가 동일한 두 배포의 경우 최신 생성 시간을 사용합니다. 자세한 내용은 Azure IoT Edge 배포 참조하세요.


deviceOption - 단일/다중 디바이스 선택
string; action == Deploy to IoT Edge devices때 필요합니다. 허용되는 값: Single Device, Multiple Devices.

태그에 따라 단일 또는 여러 디바이스에 배포하도록 선택합니다.


deviceId - IoT Edge 디바이스 ID
string; deviceOption == Single Device때 필요합니다.

IoT Edge device ID입력합니다.


targetcondition - IoT Edge 디바이스 대상 조건
string; deviceOption == Multiple Devices때 필요합니다.

배포하려는 디바이스의 target condition 입력합니다. 큰따옴표를 사용하지 마세요. 예: tags.building=9tags.environment='test'. 자세한 내용은 Azure IoT Edge 배포 참조하세요.


컨테이너 레지스트리 유형containerregistrytype -
string; action = Push module images때 필요합니다. 허용되는 값: Azure Container Registry, Generic Container Registry. 기본값은 Azure Container Registry입니다.

Container Registry Type선택합니다. Azure Container Registry ACR용이며, Generic Container Registry docker 허브를 포함한 일반 레지스트리용입니다.


Docker 레지스트리 연결dockerRegistryConnection -
입력 별칭: dockerRegistryEndpoint. string; containerregistrytype = Generic Container Registry때 필요합니다.

일반 Docker 레지스트리 연결을 선택합니다. 빌드 및 푸시에 필요합니다.


Azure 구독
string; 선택 사항. containerregistrytype = Azure Container Registry때 사용합니다.

Azure 구독을 선택합니다.


Azure Container RegistryazureContainerRegistry -
string; containerregistrytype = Azure Container Registry때 필요합니다.

Azure Container Registry를 지정합니다. 이 값은 json 형식으로 지정해야 합니다.

azureContainerRegistry: '{"loginServer": "contoso.azurecr.io"}

파일templateFilePath - .template.json
string; action = Build module images || action = Push module images || action = Generate deployment manifest때 필요합니다. 기본값은 deployment.template.json입니다.

Azure IoT Edge 솔루션의 경로는 .template.json. 이 파일은 Azure IoT Edge 솔루션에서 모듈 및 경로를 정의합니다. 파일 이름은 .template.json.


기본 플랫폼defaultPlatform -
string; action = Build module images || action = Push module images || action = Generate deployment manifest때 필요합니다. 허용되는 값: amd64, windows-amd64, arm32v7arm64v8. 기본값은 amd64입니다.

.template.json모듈 플랫폼을 지정하지 않은 상태로 둘 수 있습니다. 이러한 모듈의 경우 기본 플랫폼이 사용됩니다.


기본 플랫폼defaultPlatform -
string; action = Build module images || action = Push module images || action = Generate deployment manifest때 필요합니다. 허용되는 값: amd64, windows-amd64, arm32v7. 기본값은 amd64입니다.

.template.json모듈 플랫폼을 지정하지 않은 상태로 둘 수 있습니다. 이러한 모듈의 경우 기본 플랫폼이 사용됩니다.


fillRegistryCredential - 배포 매니페스트에 레지스트리 자격 증명 추가
string; action = Push module images때 필요합니다. 허용되는 값: true, false. 기본값은 true입니다.

Docker 이미지를 배포 매니페스트에 푸시하기 위한 레지스트리 자격 증명을 추가합니다.


deploymentManifestOutputPath - 출력 경로
string; action == Generate deployment manifest때 필요합니다. 기본값은 $(System.DefaultWorkingDirectory)/config/deployment.json입니다.

생성된 배포 매니페스트의 출력 경로입니다.


validateGeneratedDeploymentManifest - 생성된 배포 매니페스트 스키마의 유효성을 검사합니다.
string; action = Generate deployment manifest때 필요합니다. 허용되는 값: true, false. 기본값은 false입니다.

생성된 배포 매니페스트가 스키마 유효성 검사를 통과하지 못하면 이 단계를 수행하지 못합니다. JSON 스키마 저장소Azure IoT Edge deployment 검색하여 최신 스키마를 찾습니다.


bypassModules - 바이패스 모듈
string; 선택 사항. action = Push module images때 사용합니다.

.template.json빌드하거나 푸시할 필요가 없는 모듈을 선택하고, 모듈 이름을 지정하고, 쉼표로 구분합니다. 예: .template.jsonSampleModule1SampleModule2 있고 SampleModule1빌드하거나 푸시하려는 경우 바이패스 모듈을 SampleModule2설정합니다. .template.json모든 모듈을 빌드하려면 이 항목을 비워 둡니다.


작업 제어 옵션

모든 작업에는 작업 입력 외에 제어 옵션이 있습니다. 자세한 내용은 컨트롤 옵션 및 일반적인 작업 속성참조하세요.

출력 변수

이 작업은 다운스트림 단계, 작업 및 단계에서 사용할 수 있는 다음 출력 변수정의합니다.

DEPLOYMENT_FILE_PATH
생성된 배포 파일의 경로입니다.

비고

이 작업을 사용하여 Azure IoT Edge에 애플리케이션을 빠르고 효율적으로 빌드, 테스트 및 배포할 수 있습니다.

이 작업은 사용자 지정 변수를 지원합니다. Pipelines에서 변수를 사용하는 방법을 잘 모르는 경우 변수 정의참조하세요.

예시

모듈 이미지 빌드

다음 YAML 예제에서는 모듈 이미지를 빌드합니다.

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

모듈 이미지 푸시

다음 YAML 예제에서는 모듈 이미지를 푸시합니다.

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: {"loginServer":"$(azureContainerRegistry)"}
    templateFilePath: deployment.template.json
    defaultPlatform: amd64
    fillRegistryCredential: true

배포 매니페스트 생성

다음 YAML 예제에서는 템플릿 파일을 기반으로 배포 매니페스트를 만듭니다.

steps:    
- task: AzureIoTEdge@2
  displayName: AzureIoTEdge - Generate deployment manifest
  inputs:
    action: Generate deployment manifest
    templateFilePath: deployment.template.json
    defaultPlatform: amd64
    deploymentManifestOutputPath: $(System.DefaultWorkingDirectory)/config/deployment.json
    validateGeneratedDeploymentManifest: false

IoT Edge 디바이스에 배포

다음 YAML 예제에서는 모듈 이미지를 배포합니다.

steps:
- task: AzureIoTEdge@2
  displayName: 'Azure IoT Edge - Deploy to IoT Edge devices'
  inputs:
    action: 'Deploy to IoT Edge devices'
    deploymentFilePath: $(System.DefaultWorkingDirectory)/config/deployment.json
    azureSubscription: $(azureSubscriptionEndpoint)
    iothubname: iothubname
    deploymentid: '$(System.TeamProject)-devops-deployment'
    priority: '0'
    deviceOption: 'Single Device'
    deviceId: deviceId

추가 예제

Azure Pipelines에서 이러한 작업을 사용하는 방법에 대한 단계별 예제는 다음 문서를 참조하세요.

요구 사항

요구 사항 설명
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
다음에서 실행 에이전트, DeploymentGroup
요구 없음
기능 이 작업은 작업의 후속 작업에 대한 요구 사항을 충족하지 않습니다.
명령 제한 어느 것이든
settable 변수 어느 것이든
에이전트 버전 지원되는 모든 에이전트 버전입니다.
작업 범주 빌드