AzurePowerShell@4 - v4 작업 Azure PowerShell

이 작업을 사용하여 Azure 환경 내에서 PowerShell 스크립트를 실행합니다. Azure 컨텍스트는 제공된 Azure Resource Manager 서비스 연결로 인증됩니다.

Syntax

# Azure PowerShell v4
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@4
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceNameARM. Required. Azure Subscription. 
    #ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type. Default: FilePath.
    #ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script Path. 
    #Inline: # string. Optional. Use when ScriptType = InlineScript. Inline Script. 
    #ScriptArguments: # string. Optional. Use when ScriptType = FilePath. Script Arguments. 
    #errorActionPreference: 'stop' # 'stop' | 'continue' | 'silentlyContinue'. ErrorActionPreference. Default: stop.
    #FailOnStandardError: false # boolean. Fail on Standard Error. Default: false.
    #RestrictContextToCurrentTask: false # boolean. Restrict scope of context to current task. Default: false.
  # Azure PowerShell version options
    #azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' | 'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default: OtherVersion.
    preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs. Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell Version. 
  # Advanced
    #pwsh: false # boolean. Use PowerShell Core. Default: false.
    #validateScriptSignature: false # boolean. Optional. Use when ScriptType = FilePath. Validate script signature. Default: false.
    #workingDirectory: # string. Working Directory.
# Azure PowerShell v4
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@4
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceNameARM. Required. Azure Subscription. 
    #ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type. Default: FilePath.
    #ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script Path. 
    #Inline: # string. Optional. Use when ScriptType = InlineScript. Inline Script. 
    #ScriptArguments: # string. Optional. Use when ScriptType = FilePath. Script Arguments. 
    #errorActionPreference: 'stop' # 'stop' | 'continue' | 'silentlyContinue'. ErrorActionPreference. Default: stop.
    #FailOnStandardError: false # boolean. Fail on Standard Error. Default: false.
    #RestrictContextToCurrentTask: false # boolean. Restrict scope of context to current task. Default: false.
  # Azure PowerShell version options
    #azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' | 'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default: OtherVersion.
    preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs. Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell Version. 
  # Advanced
    #pwsh: false # boolean. Use PowerShell Core. Default: false.
    #workingDirectory: # string. Working Directory.
# Azure PowerShell v4
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@4
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceNameARM. Required. Azure Subscription. 
    #ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type. Default: FilePath.
    #ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script Path. 
    #Inline: # string. Optional. Use when ScriptType = InlineScript. Inline Script. 
    #ScriptArguments: # string. Optional. Use when ScriptType = FilePath. Script Arguments. 
    #errorActionPreference: 'stop' # 'stop' | 'continue' | 'silentlyContinue'. ErrorActionPreference. Default: stop.
    #FailOnStandardError: false # boolean. Fail on Standard Error. Default: false.
  # Azure PowerShell version options
    #azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' | 'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default: OtherVersion.
    preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs. Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell Version. 
  # Advanced
    #pwsh: false # boolean. Use PowerShell Core. Default: false.
    #workingDirectory: # string. Working Directory.
# Azure PowerShell v4
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@4
  inputs:
    azureSubscription: # string. Alias: ConnectedServiceNameARM. Required. Azure Subscription. 
    #ScriptType: 'FilePath' # 'FilePath' | 'InlineScript'. Script Type. Default: FilePath.
    #ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script Path. 
    #Inline: # string. Optional. Use when ScriptType = InlineScript. Inline Script. 
    #ScriptArguments: # string. Optional. Use when ScriptType = FilePath. Script Arguments. 
    #errorActionPreference: 'stop' # 'stop' | 'continue' | 'silentlyContinue'. ErrorActionPreference. Default: stop.
    #FailOnStandardError: false # boolean. Fail on Standard Error. Default: false.
  # Azure PowerShell version options
    #azurePowerShellVersion: 'OtherVersion' # 'LatestVersion' | 'OtherVersion'. Alias: TargetAzurePs. Azure PowerShell Version. Default: OtherVersion.
    preferredAzurePowerShellVersion: # string. Alias: CustomTargetAzurePs. Required when TargetAzurePs = OtherVersion. Preferred Azure PowerShell Version.

입력

azureSubscription - Azure 구독
입력 별칭: ConnectedServiceNameARM. string. 필수 요소.

PowerShell을 실행하기 전에 구성할 Azure Resource Manager 구독입니다.


ScriptType - 스크립트 유형
string. 허용되는 값: FilePath (스크립트 파일 경로), InlineScript (인라인 스크립트). 기본값은 FilePath입니다.

스크립트의 형식: 파일 경로 또는 인라인입니다.


ScriptPath - 스크립트 경로
string. 선택 사항입니다. 을 사용할 때 ScriptType = FilePath사용합니다.

스크립트의 경로입니다. 정규화된 경로이거나 기본 작업 디렉터리에 상대적인 경로여야 합니다.


Inline - 인라인 스크립트
string. 선택 사항입니다. 을 사용할 때 ScriptType = InlineScript사용합니다. 기본값은 # You can write your azure powershell scripts inline here. \n# You can also pass predefined and custom variables to this script using arguments입니다.

실행할 스크립트를 지정합니다. 지원되는 최대 인라인 스크립트 길이는 5000자입니다. 더 긴 스크립트를 사용하려면 파일의 스크립트를 사용합니다.


ScriptArguments - 스크립트 인수
string. 선택 사항입니다. 을 사용할 때 ScriptType = FilePath사용합니다.

PowerShell에 전달할 추가 매개 변수입니다. 서수 또는 명명된 매개 변수일 수 있습니다.


errorActionPreference - ErrorActionPreference
string. 허용되는 값: stop, continue, silentlyContinue. 기본값은 stop입니다.

스크립트를 실행하기 위한 변수 값을 ErrorActionPreference 선택합니다.


FailOnStandardError - 표준 오류 발생 시 실패
boolean. 기본값은 false입니다.

이 경우 오류가 오류 파이프라인에 기록되거나 표준 오류 스트림에 데이터가 기록되면 이 작업이 실패합니다.


RestrictContextToCurrentTask - 컨텍스트의 scope 현재 작업으로 제한
boolean. 기본값은 false입니다.

이 경우 이 작업은 컨텍스트의 scope 현재 작업으로만 제한하며 프라이빗 에이전트를 사용할 때 파이프라인의 다른 태스크에서는 컨텍스트를 사용할 수 없습니다.


azurePowerShellVersion - Azure PowerShell 버전
입력 별칭: TargetAzurePs. string. 허용되는 값: LatestVersion (최신 설치된 버전), OtherVersion (다른 버전 지정). 기본값은 OtherVersion입니다.

호스트된 에이전트의 경우 지원되는 Azure PowerShell 버전은 ( 1.0.0 호스트된 VS2017 큐)입니다. 에이전트에서 사용할 수 있는 최신 버전을 선택하려면 (설치된 최신 버전)을 선택합니다 LatestVersion .

프라이빗 에이전트의 경우 를 사용하여 OtherVersion 기본 버전의 Azure PowerShell 지정할 수 있습니다(다른 버전 지정).


preferredAzurePowerShellVersion - 기본 Azure PowerShell 버전
입력 별칭: CustomTargetAzurePs. string. 필요한 경우 TargetAzurePs = OtherVersion입니다.

기본 Azure PowerShell 버전은 적절한 의미 체계 버전이어야 합니다. 1.2.3. 와 같은 2.\*,2.3.\* 정규식은 지원되지 않습니다. 호스트된 VS2017 풀은 현재 Az 모듈 버전을 지원합니다. 1.0.0.


pwsh - PowerShell Core 사용
boolean. 기본값은 false입니다.

이 경우 Windows에서 작업은 대신 powershell.exe경로에서 를 사용합니다pwsh.exe.


validateScriptSignature - 스크립트 서명 유효성 검사
boolean. 선택 사항입니다. 을 사용할 때 ScriptType = FilePath사용합니다. 기본값은 false입니다.

이 경우 작업이 먼저 검사 지정한 스크립트를 실행하기 전에 서명되고 유효한지 확인합니다.


workingDirectory - 작업 디렉터리
string.

스크립트가 실행되는 작업 디렉터리입니다.


작업 제어 옵션

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

출력 변수

없음

설명

Az Module 및 플랫폼 간 에이전트에 대한 지원이 추가되었습니다.

요구 사항

요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트, DeploymentGroup
요청 없음
Capabilities 이 작업은 작업의 후속 작업에 대한 요구를 충족하지 않습니다.
명령 제한 사항 모두
설정 가능한 변수 모두
에이전트 버전 2.115.0 이상
작업 범주 배포