使用此任务可以部署、启动、停止和删除 Azure 资源组。
此任务已弃用;使用 AzureResourceGroupDeployment@2。
语法
# Azure Resource Group Deployment v1
# Deploy, start, stop, delete Azure Resource Groups.
- task: AzureResourceGroupDeployment@1
inputs:
#ConnectedServiceNameSelector: 'ConnectedServiceName' # 'ConnectedServiceName' | 'ConnectedServiceNameClassic'. Azure Connection Type. Default: ConnectedServiceName.
ConnectedServiceName: # string. Required when ConnectedServiceNameSelector = ConnectedServiceName. Azure Subscription.
#ConnectedServiceNameClassic: # string. Required when ConnectedServiceNameSelector = ConnectedServiceNameClassic. Azure Classic Subscription.
action: 'Create Or Update Resource Group' # 'Create Or Update Resource Group' | 'Select Resource Group' | 'Start' | 'Stop' | 'Restart' | 'Delete' | 'DeleteRG'. Required when ConnectedServiceNameSelector = ConnectedServiceName. Action. Default: Create Or Update Resource Group.
#actionClassic: 'Select Resource Group' # 'Select Resource Group'. Required when ConnectedServiceNameSelector = ConnectedServiceNameClassic. Action. Default: Select Resource Group.
resourceGroupName: # string. Required when ConnectedServiceNameSelector = ConnectedServiceName. Resource Group.
#cloudService: # string. Required when ConnectedServiceNameSelector = ConnectedServiceNameClassic. Cloud Service.
#___location: 'East US' # 'Australia East' | 'Australia Southeast' | 'Brazil South' | 'Canada Central' | 'Canada East' | 'Central India' | 'Central US' | 'East Asia' | 'East US' | 'East US 2 ' | 'Japan East' | 'Japan West' | 'North Central US' | 'North Europe' | 'South Central US' | 'South India' | 'Southeast Asia' | 'UK South' | 'UK West' | 'West Central US' | 'West Europe' | 'West India' | 'West US' | 'West US 2'. Required when action = Create Or Update Resource Group. Location. Default: East US.
#csmFile: # string. Required when action = Create Or Update Resource Group. Template.
#csmParametersFile: # string. Optional. Use when action = Create Or Update Resource Group. Template Parameters.
#overrideParameters: # string. Optional. Use when action = Create Or Update Resource Group. Override Template Parameters.
#deploymentMode: 'Incremental' # 'Validation' | 'Incremental' | 'Complete'. Required when action = Create Or Update Resource Group. Deployment Mode. Default: Incremental.
#enableDeploymentPrerequisitesForCreate: false # boolean. Optional. Use when action = Create Or Update Resource Group. Enable Deployment Prerequisites. Default: false.
#enableDeploymentPrerequisitesForSelect: false # boolean. Optional. Use when action = Select Resource Group. Enable Deployment Prerequisites. Default: false.
# Output
#outputVariable: # string. Resource Group.
输入
ConnectedServiceNameSelector
-
Azure 连接类型
string
。 允许的值:ConnectedServiceName
(Azure 资源管理器)、ConnectedServiceNameClassic
(Azure 经典)。 默认值:ConnectedServiceName
。
必填。 选择包含部署的 Azure 订阅的服务连接。
ConnectedServiceName
-
Azure 订阅
string
。
ConnectedServiceNameSelector = ConnectedServiceName
时是必需的。
必填。 选择包含部署的 Azure 订阅的服务连接。
ConnectedServiceNameClassic
-
Azure 经典订阅
string
。
ConnectedServiceNameSelector = ConnectedServiceNameClassic
时是必需的。
为部署选择 Azure 经典订阅。
action
-
操作
string
。
ConnectedServiceNameSelector = ConnectedServiceName
时是必需的。 允许的值:Create Or Update Resource Group
、Select Resource Group
、Start
(启动虚拟机)、Stop
(停止虚拟机)、Restart
(重启虚拟机)、Delete
(删除虚拟机)、DeleteRG
(删除资源组)。 默认值:Create Or Update Resource Group
。
要对 Azure 资源或资源组执行的操作。
actionClassic
-
操作
string
。
ConnectedServiceNameSelector = ConnectedServiceNameClassic
时是必需的。 允许的值:Select Resource Group
(选择云服务)。 默认值:Select Resource Group
。
要对 Azure 资源或云服务执行的作。
resourceGroupName
-
资源组
string
。
ConnectedServiceNameSelector = ConnectedServiceName
时是必需的。
提供资源组的名称。
cloudService
-
云服务
string
。
ConnectedServiceNameSelector = ConnectedServiceNameClassic
时是必需的。
提供云服务的名称。
___location
-
位置
string
。
action = Create Or Update Resource Group
时是必需的。 允许的值:Australia East
、Australia Southeast
、Brazil South
、Canada Central
、Canada East
、Central India
、Central US
、East Asia
、East US
、East US 2
、Japan East
Japan West
、North Central US
、North Europe
、South Central US
、South India
、Southeast Asia
、UK South
、UK West
、West Central US
、West Europe
、West India
、West US
、West US 2
。 默认值:East US
。
部署资源组的位置。 如果订阅中已存在资源组,则将忽略此值。
csmFile
-
模板
string
。
action = Create Or Update Resource Group
时是必需的。
指定指向 Azure 资源管理器模板的路径或模式。 详细了解 Azure 资源管理器模板。 若要立即开始,请使用此示例模板 。
csmParametersFile
-
模板参数
string
。 可选。 当 action = Create Or Update Resource Group
时使用。
指定参数文件的 URL。 示例 URL:https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-simple-windows/azuredeploy.parameters.json
若要使用存储在专用存储帐户中的文件,请在模板的 URL 中检索和包含共享访问签名 (SAS) 令牌。 示例:<blob_storage_url>/template.json?<SAStoken>
若要将参数文件上传到存储帐户并生成 SAS 令牌,请使用 Azure 文件复制 任务,或使用 PowerShell 或 Azure CLI执行步骤。
若要查看网格中的模板参数,请单击替代模板参数文本框旁边的 …
。 此功能要求在源中启用 CORS 规则。 如果模板位于 Azure 存储 blob 中,请参阅 跨域资源共享 以启用 CORS。
overrideParameters
-
替代模板参数
string
。 可选。 当 action = Create Or Update Resource Group
时使用。
指定要重写的模板参数。
若要查看网格中的模板参数,请单击“替代参数”文本框中旁边的 ...
。 此功能要求在源中启用 CORS 规则。 如果模板位于 Azure 存储 Blob 中,请引用此字符串以启用 CORS,或键入模板参数以在文本框中重写。
示例:-storageName fabrikam -adminUsername $(vmusername) -adminPassword (ConvertTo-SecureString -String '$(password)' -AsPlainText -Force) -azureKeyVaultName $(fabrikamFibre)
。
如果参数值具有多个单词,请将单词括在引号中,即使使用变量传递值也是如此。
例如,-name "parameter value" -name2 "$(var)"
。
若要重写对象类型参数,请使用字符串化的 JSON 对象。
例如,-options ["option1"] -map {"key1": "value1" }
。
deploymentMode
-
部署模式
string
。
action = Create Or Update Resource Group
时是必需的。 允许的值:Validation
(仅验证)、Incremental
、Complete
。 默认值:Incremental
。
Incremental
模式将部署作为对资源组的增量更新进行处理。 它保留资源组中存在但未在模板中指定的未更改的资源。
Complete
模式将删除不在模板中的资源。 完整模式所需的时间比增量模式要长。 如果任务超时,请考虑增加超时或更改为 Incremental
模式。
警告
完整模式将删除未在模板中指定的资源组中的所有现有资源。 请检查要部署到的资源组是否不包含模板中未指定的任何必要资源。
通过 Validate
模式,可以在创建实际资源之前查找模板的问题。
注释
即使未部署任何资源,Validate
模式也会始终创建资源组。
详细了解 部署模式。
enableDeploymentPrerequisitesForCreate
-
启用部署先决条件
boolean
。 可选。 当 action = Create Or Update Resource Group
时使用。 默认值:false
。
仅当资源组包含虚拟机时适用。
选择“部署组”选项可在每个虚拟机上配置部署组代理。
选择 WinRM 选项会使用自签名证书通过端口 5986 上的 HTTPS 协议配置 Windows 远程管理(WinRM)侦听器。 在 Azure 计算机上执行部署操作需要此配置。 如果目标虚拟机由负载均衡器提供支持,请确保为目标端口(5986)配置入站 NAT 规则。
enableDeploymentPrerequisitesForSelect
-
启用部署先决条件
boolean
。 可选。 当 action = Select Resource Group
时使用。 默认值:false
。
仅当资源组包含虚拟机时适用。
选择“部署组”选项可在每个虚拟机上配置部署组代理。
选择 WinRM 选项会使用自签名证书通过端口 5986 上的 HTTPS 协议配置 Windows 远程管理(WinRM)侦听器。 在 Azure 计算机上执行部署操作需要此配置。 如果目标虚拟机由负载均衡器提供支持,请确保为目标端口(5986)配置入站 NAT 规则。
outputVariable
-
资源组
string
。
选择现有资源组时是必需的。 提供资源组变量的名称。 该变量可用作 $(variableName)
来引用后续任务中的资源组,例如用于部署应用程序的 PowerShell 中的 PowerShell。
仅在所选操作 Create
、Update
或 Select
时才有效。
任务控制选项
除任务输入之外,所有任务都具有控制选项。 有关详细信息,请参阅 控件选项和常见任务属性。
输出变量
没有。