AzurePowerShell@1 - Azure PowerShell v1 工作

使用此工作在 Azure 環境中執行 PowerShell 腳本。 Azure 內容會使用提供的 Azure Resource Manager服務連線進行驗證。

Syntax

# Azure PowerShell v1
# Run a PowerShell script within an Azure environment.
- task: AzurePowerShell@1
  inputs:
    #ConnectedServiceNameSelector: 'ConnectedServiceName' # 'ConnectedServiceName' | 'ConnectedServiceNameARM'. Azure Connection Type. Default: ConnectedServiceName.
    ConnectedServiceName: # string. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Classic Subscription. 
    #ConnectedServiceNameARM: # string. 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.

輸入

ConnectedServiceNameSelector - Azure 連線類型
string. 允許的值: ConnectedServiceName (Azure 傳統) , ConnectedServiceNameARM (Azure Resource Manager) 。 預設值:ConnectedServiceName


ConnectedServiceName - Azure 傳統訂用帳戶
string. 當 ConnectedServiceNameSelector = ConnectedServiceName 時為必要。

執行 PowerShell 之前要設定的 Azure 傳統訂用帳戶。


ConnectedServiceNameARM - Azure 訂用帳戶
string. 當 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

指定要執行的腳本。 支援的內嵌腳本長度上限為 500 個字元。 如果您想要使用較長的腳本,請使用檔案中的腳本。


ScriptArguments - 腳本引數
string.

要傳遞至 PowerShell 的其他參數。 這些可以是序數或具名參數。


工作控制選項

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

輸出變數

無。

規格需求

需求 描述
管線類型 YAML、傳統組建、傳統版本
執行于 Agent、DeploymentGroup
要求 自我裝載代理程式必須具備符合下列需求的功能,才能執行使用此工作的作業:azureps
Capabilities 此工作不符合作業中後續工作的任何需求。
命令限制 任意
Settable 變數 任意
代理程式版本 1.95.0 或更新版本
工作類別 部署