次の方法で共有


AzureCLI@0 - Azure CLI Preview v0 タスク

Azure サブスクリプションに対して Azure CLI コマンドを使用してシェルまたはバッチ スクリプトを実行します。

構文

# Azure CLI Preview v0
# Run a Shell or Batch script with Azure CLI commands against an azure subscription.
- task: AzureCLI@0
  inputs:
    connectedServiceNameSelector: 'connectedServiceNameARM' # 'connectedServiceName' | 'connectedServiceNameARM'. Required. Azure Connection Type. Default: connectedServiceNameARM.
    connectedServiceNameARM: # string. Required when connectedServiceNameSelector = connectedServiceNameARM. AzureRM Subscription. 
    #connectedServiceName: # string. Required when connectedServiceNameSelector = connectedServiceName. Azure Classic Subscription. 
    scriptLocation: 'scriptPath' # 'inlineScript' | 'scriptPath'. Required. Script Location. Default: scriptPath.
    scriptPath: # string. Required when scriptLocation = scriptPath. Script Path. 
    #inlineScript: # string. Required when scriptLocation = inlineScript. Inline Script. 
    #args: # string. Arguments. 
  # Advanced
    #cwd: # string. Working Directory. 
    #failOnStandardError: true # boolean. Fail on Standard Error. Default: true.

入力

connectedServiceNameSelector - Azure 接続の種類
string. 必須です。 使用できる値: connectedServiceName (Azure クラシック)、 connectedServiceNameARM (Azure Resource Manager)。 既定値: connectedServiceNameARM

デプロイの Azure 接続の種類を選択します。


connectedServiceNameARM - AzureRM サブスクリプション
string. 次の場合に connectedServiceNameSelector = connectedServiceNameARM必要です。

デプロイの Azure Resource Manager サブスクリプションを選択します。


connectedServiceName - Azure クラシック サブスクリプション
string. 次の場合に connectedServiceNameSelector = connectedServiceName必要です。

デプロイの Azure クラシック サブスクリプションを選択します。


scriptLocation - スクリプトの場所
string. 必須です。 使用できる値: inlineScript (インライン スクリプト)、 scriptPath (スクリプト パス)。 既定値: scriptPath

スクリプトの場所を選択します。


scriptPath - スクリプト パス
string. 次の場合に scriptLocation = scriptPath必要です。

スクリプトの完全修飾パス、または既定の作業ディレクトリを基準としたパス。


inlineScript - インライン スクリプト
string. 次の場合に scriptLocation = inlineScript必要です。

ここでスクリプトをインラインで記述できます。 バッチ ファイルの場合は、すべての Azure コマンドの前にプレフィックス call を使用します。 引数を使用して、定義済みの変数やカスタム変数をこのスクリプトに渡すこともできます。

次の例を参照してください。 1 つ目はシェルの例で、2 つ目はバッチの例です。

azure --version || azure account show 
call  azure --version || call azure account show

args - 引数
string.

スクリプトに渡される引数。


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

スクリプトが実行されている現在の作業ディレクトリ。 空白のままにした場合、この入力はリポジトリ (ビルド) または成果物 (リリース) のルートです。これは $(System.DefaultWorkingDirectory).


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

これが true の場合、エラーが StandardError ストリームに書き込まれると、このタスクは失敗します。


タスクコントロールのオプション

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

出力変数

[なし] :

必要条件

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