このタスクを使用して、Azure 環境内で PowerShell スクリプトを実行します。 Azure コンテキストは、指定された Azure Resource Manager サービス接続で認証されます。
構文
# 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.
Azure クラシック サブスクリプションの ConnectedServiceName -
string。
ConnectedServiceNameSelector = ConnectedServiceNameする場合に必要です。
PowerShell を実行する前に構成する Azure クラシック サブスクリプション。
Azure サブスクリプションの ConnectedServiceNameARM -
string。
ConnectedServiceNameSelector = ConnectedServiceNameARMする場合に必要です。
PowerShell を実行する前に構成する Azure Resource Manager サブスクリプション。
ScriptType
-
スクリプトの種類
string。 必須。 使用できる値: FilePath (スクリプト ファイル パス)、InlineScript (インライン スクリプト)。 既定値: FilePath.
スクリプトの種類: ファイル パスまたはインライン。
ScriptPath
-
スクリプト パスの
string。 任意
ScriptType = FilePathするときに使用します。
スクリプトのパス。 これは、完全修飾パス、または既定の作業ディレクトリに対する相対パスである必要があります。
インライン スクリプト の
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 に渡す追加のパラメーター。 これらは、序数パラメーターまたは名前付きパラメーターのいずれかです。
タスク コントロールのオプション
すべてのタスクには、タスク入力に加えて制御オプションがあります。 詳細については、「コントロール オプションと一般的なタスク プロパティを参照してください。
出力変数
なし。