AzureCLI@0 - Azure CLI Preview v0 工作

對 Azure 訂用帳戶使用 Azure CLI 命令執行殼層或批次腳本。

Syntax

# 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 。 您也可以使用引數將預先定義及自訂的變數傳遞至此指令碼。

請參閱以下範例。 第一個是殼層範例,第二個是批次範例:

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

args - 參數
string.

傳遞至腳本的引數。


cwd - 工作目錄
string.

執行腳本的目前工作目錄。 如果保留空白,則此輸入是 (組建) 或成品 (發行) 的存放庫根目錄,也就是 $(System.DefaultWorkingDirectory)


failOnStandardError - 標準錯誤失敗
boolean. 預設值:true

如果這是 true,當任何錯誤寫入 StandardError 資料流程時,此工作將會失敗。


工作控制項選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控制選項和一般工作屬性

輸出變數

無。

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
在 上執行 Agent、DeploymentGroup
要求
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任意
可設定變數 任意
代理程式版本 1.95.0 或更新版本
工作類別 部署