AzurePowerShell@1 - Azure PowerShell v1 任务
使用此任务在 Azure 环境中运行 PowerShell 脚本。 Azure 上下文使用提供的 Azure 资源管理器 服务连接进行身份验证。
语法
# 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 资源管理器) 。 默认值:ConnectedServiceName
。
ConnectedServiceName
- Azure 经典订阅
string
. 当 ConnectedServiceNameSelector = ConnectedServiceName
时,需要此选项。
运行 PowerShell 之前要配置的 Azure 经典订阅。
ConnectedServiceNameARM
- Azure 订阅
string
. 当 ConnectedServiceNameSelector = ConnectedServiceNameARM
时,需要此选项。
运行 PowerShell 之前要配置的 Azure 资源管理器订阅。
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 的其他参数。 这些参数可以是序号参数,也可以是命名参数。
任务控制选项
除了任务输入,所有任务都有控制选项。 有关详细信息,请参阅 控制选项和常见任务属性。
输出变量
无。
要求
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈