このタスクを使用して、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.
入力
azureConnectionType
-
Azure 接続の種類の
入力エイリアス: 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するときに使用します。
スクリプトのパス。 これは、完全修飾パス、または既定の作業ディレクトリに対する相対パスである必要があります。
インライン スクリプト の
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.
実行するスクリプトを指定します。 サポートされるインライン スクリプトの最大長は 5,000 文字です。 より長いスクリプトを使用する場合は、ファイルのスクリプトを使用します。
ScriptArguments
-
スクリプト引数の
string。 任意
ScriptType = FilePathするときに使用します。
PowerShell に渡す追加のパラメーター。 これらは、序数パラメーターまたは名前付きパラメーターのいずれかです。
errorActionPreference
-
ErrorActionPreference (エラーアクションプリファレンス)
string。 使用できる値: stop、continue、silentlyContinue。 既定値: stop.
スクリプトを実行するための ErrorActionPreference 変数の値を選択します。
標準エラーで失敗する FailOnStandardError -
boolean。 既定値: false.
これが true の場合、エラーがエラー パイプラインに書き込まれたり、データが標準エラー ストリームに書き込まれたりすると、このタスクは失敗します。
azurePowerShellVersion
-
Azure PowerShell バージョン
入力エイリアス: 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 の優先バージョンを指定できます (他のバージョンを指定します)。
推奨される Azure PowerShell バージョンを preferredAzurePowerShellVersion - する
入力エイリアス: 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.
これが true の場合、タスクは最初に、指定されたスクリプトが署名され、有効であることを確認してから実行します。
タスク コントロールのオプション
すべてのタスクには、タスク入力に加えて制御オプションがあります。 詳細については、「コントロール オプションと一般的なタスク プロパティを参照してください。
出力変数
なし。
注釈
標準エラー時の失敗と ErrorActionPreference のサポートを追加しました。