이 작업을 사용하여 Azure 환경 내에서 PowerShell 스크립트를 실행합니다. Azure 컨텍스트는 제공된 Azure Resource Manager 서비스 연결로 인증됩니다.
이 버전의 작업은 더 이상 사용되지 않습니다. AzurePowerShell@5사용합니다.
이 작업을 사용하여 Azure 환경 내에서 PowerShell 스크립트를 실행합니다. Azure 컨텍스트는 제공된 Azure Resource Manager 서비스 연결로 인증됩니다.
구문론
# Azure PowerShell v3
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@3
inputs:
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. 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
#validateScriptSignature: false # boolean. Optional. Use when ScriptType = FilePath. Validate script signature. Default: false.
# Azure PowerShell v3
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@3
inputs:
#azureConnectionType: 'ConnectedServiceNameARM' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Alias: ConnectedServiceNameSelector. Azure Connection Type. Default: ConnectedServiceNameARM.
#azureClassicSubscription: # string. Alias: ConnectedServiceName. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription.
azureSubscription: # string. Alias: ConnectedServiceNameARM. Required when ConnectedServiceNameSelector = ConnectedServiceNameARM. 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.
입력
Azure 연결 유형azureConnectionType -
입력 별칭: ConnectedServiceNameSelector.
string; 허용되는 값: ConnectedServiceName(Azure 클래식), ConnectedServiceNameARM(Azure Resource Manager). 기본값은 ConnectedServiceNameARM입니다.
Azure 클래식 구독azureClassicSubscription -
입력 별칭: ConnectedServiceName.
string;
ConnectedServiceNameSelector = ConnectedServiceName때 필요합니다.
PowerShell을 실행하기 전에 구성할 Azure 클래식 구독입니다.
Azure 구독azureSubscription -
입력 별칭: ConnectedServiceNameARM.
string;
ConnectedServiceNameSelector = ConnectedServiceNameARM때 필요합니다.
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입니다.
이 경우 오류가 오류 파이프라인에 기록되거나 표준 오류 스트림에 데이터가 기록되는 경우 이 작업이 실패합니다.
Azure PowerShell 버전azurePowerShellVersion -
입력 별칭: TargetAzurePs.
string; 허용되는 값: LatestVersion(최신 설치된 버전), OtherVersion(다른 버전 지정). 기본값은 OtherVersion입니다.
호스트된 에이전트의 경우 지원되는 Azure PowerShell 버전은 2.1.0, 3.8.0, 4.2.1, 5.1.1 및 6.7.0.
에이전트에서 사용 가능한 최신 버전을 선택하려면 LatestVersion(최신 설치된 버전)를 선택합니다.
프라이빗 에이전트의 경우 OtherVersion 사용하여 기본 버전의 Azure PowerShell을 지정할 수 있습니다(다른 버전 지정).
preferredAzurePowerShellVersion
-
기본 Azure PowerShell 버전
입력 별칭: CustomTargetAzurePs.
string;
TargetAzurePs = OtherVersion때 필요합니다.
기본 Azure PowerShell 버전은 적절한 의미 체계 버전이어야 합니다.
1.2.3.;
2.\*,2.3.\* 같은 정규식은 지원되지 않습니다. 호스트된 에이전트는 현재 Azure 모듈 버전 2.1.0, 3.8.0, 4.2.1, 5.1.1 및 AzureRM 모듈 버전 2.1.0, 3.8.0, 4.2.1, 5.1.1, 6.7.0지원합니다.
스크립트 서명유효성 검사 validateScriptSignature -
boolean; 선택 사항.
ScriptType = FilePath때 사용합니다. 기본값은 false입니다.
이 경우 태스크는 먼저 지정된 스크립트를 실행하기 전에 서명되고 유효한지 확인합니다.
작업 제어 옵션
모든 작업에는 작업 입력 외에 제어 옵션이 있습니다. 자세한 내용은 컨트롤 옵션 및 일반적인 작업 속성참조하세요.
출력 변수
없음.
비고
표준 오류 및 ErrorActionPreference에 대한 지원이 추가되었습니다.
요구 사항
| 요구 사항 | 설명 |
|---|---|
| 파이프라인 유형 | YAML, 클래식 빌드, 클래식 릴리스 |
| 다음에서 실행 | 에이전트, DeploymentGroup |
| 요구 | 자체 호스팅 에이전트에는 다음 요구 사항과 일치하는 기능이 있어야 하며, 이 작업을 사용하는 작업을 실행해야 합니다. |
| 기능 | 이 작업은 작업의 후속 작업에 대한 요구 사항을 충족하지 않습니다. |
| 명령 제한 | 어느 것이든 |
| settable 변수 | 어느 것이든 |
| 에이전트 버전 | 2.0.0 이상 |
| 작업 범주 | 배치하다 |