AzurePowerShell@2 - v2 タスクをAzure PowerShellする

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

構文

# Azure PowerShell v2
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@2
  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'. Required. Script Type. Default: FilePath.
    #ScriptPath: # string. Optional. Use when ScriptType = FilePath. Script Path. 
    #Inline: # string. Optional. Use when ScriptType = InlineScript. Inline Script. 
    #ScriptArguments: # string. Script Arguments. 
    #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 接続の種類
入力エイリアス: ConnectedServiceNameSelectorstring. 使用できる値: ConnectedServiceName (Azure クラシック)、 ConnectedServiceNameARM (Azure Resource Manager)。 既定値: ConnectedServiceNameARM


azureClassicSubscription - Azure クラシック サブスクリプション
入力エイリアス: ConnectedServiceNamestring. ConnectedServiceNameSelector = ConnectedServiceName の場合に必要です。

PowerShell を実行する前に構成する Azure クラシック サブスクリプション。


azureSubscription - Azure サブスクリプション
入力エイリアス: ConnectedServiceNameARMstring. 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

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


ScriptArguments - スクリプト引数
string.

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


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

ホストされているエージェントの場合、サポートされているAzure PowerShellバージョンは2.1.0、、3.8.04.2.15.1.1および 6.7.0です。 エージェントで使用可能な最新バージョンを選択するには、[(インストールされている最新バージョン)] を選択 LatestVersion します。

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


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

推奨されるAzure PowerShellバージョンは、適切なセマンティック バージョンである必要があります。 1.2.3.. Regex like 2.\*,2.3.\* はサポートされていません。 現在、ホストされるエージェントでは、Azure モジュールの2.1.0バージョン 、、3.8.04.2.15.1.1および AzureRM モジュールのバージョン 、3.8.04.2.15.1.16.7.0がサポートされています2.1.0


タスク制御オプション

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

出力変数

[なし] :

必要条件

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