AzurePowerShell@4 - v4 タスクをAzure PowerShellする

このタスクを使用して、Azure 環境内で PowerShell スクリプトを実行します。 Azure コンテキストは、提供された Azure Resource Manager サービス接続で認証されます。

構文

# 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 サブスクリプション
入力エイリアス: ConnectedServiceNameARMstring. 必須です。

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

実行するスクリプトを指定します。 サポートされているインライン スクリプトの最大長は 5,000 文字です。 より長いスクリプトを使用する場合は、ファイルのスクリプトを使用します。


ScriptArguments - スクリプト引数
string. 省略可能。 の場合は ScriptType = FilePathを使用します。

PowerShell に渡す追加のパラメーター。 序数パラメーターまたは名前付きパラメーターを指定できます。


errorActionPreference - ErrorActionPreference
string. 許可値: stopcontinuesilentlyContinue。 既定値: stop

スクリプトを実行するための変数の ErrorActionPreference 値を選択します。


FailOnStandardError - 標準エラーで失敗する
boolean. 既定値: false

これが true の場合、エラーがエラー パイプラインに書き込まれた場合、または標準エラー ストリームにデータが書き込まれる場合、このタスクは失敗します。


RestrictContextToCurrentTask - コンテキストのスコープを現在のタスクに制限する
boolean. 既定値: false

これが true の場合、このタスクはコンテキストのスコープを現在のタスクのみに制限し、プライベート エージェントを使用する場合、パイプライン内の他のタスクではコンテキストを使用できなくなります。


azurePowerShellVersion - Azure PowerShell バージョン
入力エイリアス: TargetAzurePsstring. 使用できる値: LatestVersion (インストールされている最新バージョン) OtherVersion 、(他のバージョンを指定)。 既定値: OtherVersion

ホストされているエージェントの場合、サポートされているAzure PowerShellバージョンは次のとおりです 1.0.0 (ホストされた VS2017 キュー)。 エージェントで使用可能な最新バージョンを選択するには、[(インストールされている最新バージョン)] を選択 LatestVersion します。

プライベート エージェントの場合は、(他のバージョンを指定する) を使用して、Azure PowerShellの優先バージョンをOtherVersion指定できます。


preferredAzurePowerShellVersion - 優先Azure PowerShellバージョン
入力エイリアス: CustomTargetAzurePsstring. TargetAzurePs = OtherVersion の場合に必要です。

推奨されるAzure PowerShellバージョンは、適切なセマンティック バージョンである必要があります。 1.2.3. Regex like 2.\*,2.3.\* はサポートされていません。 ホステッド VS2017 プールでは現在、Az モジュール バージョンがサポートされています 1.0.0.


pwsh - PowerShell Core を使用する
boolean. 既定値: false

これが true の場合、Windows では、タスクは ではなくパスpowershell.exeからを使用pwsh.exeします。


validateScriptSignature - スクリプト署名を検証する
boolean. 省略可能。 の場合は ScriptType = FilePathを使用します。 既定値: false

これが true の場合、タスクは最初にチェックして、指定したスクリプトが署名され、有効であることを確認してから実行します。


workingDirectory - 作業ディレクトリ
string.

スクリプトが実行される作業ディレクトリ。


タスク制御オプション

すべてのタスクには、タスク入力に加えて制御オプションがあります。 詳細については、「 コントロール オプションと一般的なタスク プロパティ」を参照してください。

出力変数

[なし] :

解説

Az Module エージェントとクロス プラットフォーム エージェントのサポートが追加されました。

要件

要件 説明
パイプラインの種類 YAML、クラシック ビルド、クラシック リリース
上で実行 エージェント、DeploymentGroup
確認要求 なし
Capabilities このタスクは、ジョブ内の後続のタスクに対する要求を満たしていません。
コマンドの制限 Any
設定可能な変数 Any
エージェントのバージョン 2.115.0 以上
タスクのカテゴリ 配置