Редактиране

Споделяне чрез


AzureResourceManagerTemplateDeployment@3 - ARM template deployment v3 task

Use this task to deploy an Azure Resource Manager (ARM) template to all deployment scopes.

Syntax

# ARM template deployment v3
# Deploy an Azure Resource Manager (ARM) template to all the deployment scopes.
- task: AzureResourceManagerTemplateDeployment@3
  inputs:
  # Azure Details
    deploymentScope: 'Resource Group' # 'Management Group' | 'Subscription' | 'Resource Group'. Required. Deployment scope. Default: Resource Group.
    azureResourceManagerConnection: # string. Alias: ConnectedServiceName. Required. Azure Resource Manager connection. 
    #subscriptionId: # string. Alias: subscriptionName. Required when deploymentScope != Management Group. Subscription. 
    #action: 'Create Or Update Resource Group' # 'Create Or Update Resource Group' | 'DeleteRG'. Required when deploymentScope = Resource Group. Action. Default: Create Or Update Resource Group.
    #resourceGroupName: # string. Required when deploymentScope = Resource Group. Resource group. 
    #location: # string. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group. Location. 
  # Template
    #templateLocation: 'Linked artifact' # 'Linked artifact' | 'URL of the file'. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group. Template location. Default: Linked artifact.
    #csmFileLink: # string. Required when templateLocation = URL of the file && action = Create Or Update Resource Group || deploymentScope != Resource Group. Template link. 
    #csmParametersFileLink: # string. Optional. Use when templateLocation = URL of the file && action = Create Or Update Resource Group || deploymentScope != Resource Group. Template parameters link. 
    #csmFile: # string. Required when templateLocation = Linked artifact && action = Create Or Update Resource Group || deploymentScope != Resource Group. Template. 
    #csmParametersFile: # string. Optional. Use when templateLocation = Linked artifact && action = Create Or Update Resource Group || deploymentScope != Resource Group. Template parameters. 
    #overrideParameters: # string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Override template parameters. 
    #deploymentMode: 'Incremental' # 'Incremental' | 'Complete' | 'Validation'. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group. Deployment mode. Default: Incremental.
  # Advanced
    #deploymentName: # string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Deployment name. 
    #deploymentOutputs: # string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Deployment outputs. 
    #addSpnToEnvironment: false # boolean. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Access service principal details in override parameters. Default: false.
    #useWithoutJSON: false # boolean. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Use individual output values without JSON.Stringify applied. Default: false.
# ARM template deployment v3
# Deploy an Azure Resource Manager (ARM) template to all the deployment scopes.
- task: AzureResourceManagerTemplateDeployment@3
  inputs:
  # Azure Details
    deploymentScope: 'Resource Group' # 'Management Group' | 'Subscription' | 'Resource Group'. Required. Deployment scope. Default: Resource Group.
    azureResourceManagerConnection: # string. Alias: ConnectedServiceName. Required. Azure Resource Manager connection. 
    #subscriptionId: # string. Alias: subscriptionName. Required when deploymentScope != Management Group. Subscription. 
    #action: 'Create Or Update Resource Group' # 'Create Or Update Resource Group' | 'DeleteRG'. Required when deploymentScope = Resource Group. Action. Default: Create Or Update Resource Group.
    #resourceGroupName: # string. Required when deploymentScope = Resource Group. Resource group. 
    #location: # string. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group. Location. 
  # Template
    #templateLocation: 'Linked artifact' # 'Linked artifact' | 'URL of the file'. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group. Template location. Default: Linked artifact.
    #csmFileLink: # string. Required when templateLocation = URL of the file && action = Create Or Update Resource Group || deploymentScope != Resource Group. Template link. 
    #csmParametersFileLink: # string. Optional. Use when templateLocation = URL of the file && action = Create Or Update Resource Group || deploymentScope != Resource Group. Template parameters link. 
    #csmFile: # string. Required when templateLocation = Linked artifact && action = Create Or Update Resource Group || deploymentScope != Resource Group. Template. 
    #csmParametersFile: # string. Optional. Use when templateLocation = Linked artifact && action = Create Or Update Resource Group || deploymentScope != Resource Group. Template parameters. 
    #overrideParameters: # string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Override template parameters. 
    #deploymentMode: 'Incremental' # 'Incremental' | 'Complete' | 'Validation'. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group. Deployment mode. Default: Incremental.
  # Advanced
    #deploymentName: # string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Deployment name. 
    #deploymentOutputs: # string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Deployment outputs. 
    #addSpnToEnvironment: false # boolean. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Access service principal details in override parameters. Default: false.

Inputs

deploymentScope - Deployment scope
string. Required. Allowed values: Management Group, Subscription, Resource Group. Default value: Resource Group.

The scope of the deployment. Learn more about deployment scopes.


azureResourceManagerConnection - Azure Resource Manager connection
Input alias: ConnectedServiceName. string. Required.

Specifies the Azure Resource Manager service connection with access to the selected deployment scope.


subscriptionId - Subscription
Input alias: subscriptionName. string. Required when deploymentScope != Management Group.

Specifies the Azure subscription.

Important

The specified value must be the subscription ID and not the subscription name.


action - Action
string. Required when deploymentScope = Resource Group. Allowed values: Create Or Update Resource Group, DeleteRG (Delete resource group). Default value: Create Or Update Resource Group.

The action to be performed on the Azure resources or resource group.


resourceGroupName - Resource group
string. Required when deploymentScope = Resource Group.

Provides the name of a resource group.


location - Location
string. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group.

Resource Group deployment scopes: The location to deploy the resource group. If the resource group already exists in the Azure subscription, then this value will be ignored. Other deployment scopes: The location to store deployment metadata.


templateLocation - Template location
string. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group. Allowed values: Linked artifact, URL of the file. Default value: Linked artifact.

The location of the Template and the Parameters JSON files. Choose Linked artifact if the files are part of the linked code/build artifacts. For linked artifacts, you can also specify the path to a Bicep file. Choose URL of the file if the JSON files are located at any publicly accessible http/https URLs. To use a file stored in a private storage account, retrieve and include the shared access signature (SAS) token in the URL of the template. Example: <blob_storage_url>/template.json?. To upload a parameters file to a storage account and generate a SAS token, you could use Azure file copy task or follow the steps using PowerShell or Azure CLI.


csmFileLink - Template link
string. Required when templateLocation = URL of the file && action = Create Or Update Resource Group || deploymentScope != Resource Group.

Specifies the URL of the template file. An example URL: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-simple-windows/azuredeploy.json

To deploy a template stored in a private storage account, retrieve and include the shared access signature (SAS) token in the URL of the template. Example: <blob_storage_url>/template.json?<SAStoken>. To upload a template file (or a linked template) to a storage account and generate a SAS token, use the Azure file copy task or follow the steps using PowerShell or Azure CLI.

To view the template parameters in a grid, click on ... next to the override template parameters text box. This feature requires that CORS rules are enabled at the source. If the templates are in an Azure storage blob, refer to Cross-Origin Resource Sharing to enable CORS.


csmParametersFileLink - Template parameters link
string. Optional. Use when templateLocation = URL of the file && action = Create Or Update Resource Group || deploymentScope != Resource Group.

Specifies the URL of the parameters file. An example URL: https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-vm-simple-windows/azuredeploy.parameters.json

To use a file stored in a private storage account, retrieve and include the shared access signature (SAS) token in the URL of the template. Example: <blob_storage_url>/template.json?<SAStoken>. To upload a template file (or a linked template) to a storage account and generate a SAS token, use the Azure file copy task or follow the steps using PowerShell or Azure CLI.

To view the template parameters in a grid, click on ... next to Override template parameters text box. This feature requires that CORS rules are enabled at the source. If the templates are in an Azure storage blob, refer to Cross-Origin Resource Sharing to enable CORS.


csmFile - Template
string. Required when templateLocation = Linked artifact && action = Create Or Update Resource Group || deploymentScope != Resource Group.

Specifies the path or a pattern pointing to the Azure Resource Manager template. Learn more about Azure Resource Manager templates. To get started immediately, use this sample template. Supports Bicep files when the Azure CLI version > 2.20.0.


csmParametersFile - Template parameters
string. Optional. Use when templateLocation = Linked artifact && action = Create Or Update Resource Group || deploymentScope != Resource Group.

Specify the path or a pattern pointing for the parameters file for the Azure Resource Manager template. Supports Bicep Param files when the Azure CLI version > 2.47.0.


overrideParameters - Override template parameters
string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group.

Specifies the template parameters to override.

To view the template parameters in a grid, click on ... next to the Override Parameters textbox. This feature requires that CORS rules are enabled at the source. If the templates are in the Azure storage blob, reference this string to enable CORS, or type the template parameters to override in the textbox.

Example: -storageName fabrikam -adminUsername $(vmusername) -adminPassword (ConvertTo-SecureString -String '$(password)' -AsPlainText -Force) -azureKeyVaultName $(fabrikamFibre).

If the parameter value has multiple words, enclose the words in quotes, even if you're passing the value by using variables. For example, -name "parameter value" -name2 "$(var)". To override object type parameters, use stringified JSON objects. For example, -options ["option1"] -map {"key1": "value1" }.


deploymentMode - Deployment mode
string. Required when action = Create Or Update Resource Group || deploymentScope != Resource Group. Allowed values: Incremental, Complete, Validation (Validation only). Default value: Incremental.

The Incremental mode handles deployments as incremental updates to the resource group. It leaves unchanged resources that exist in the resource group but are not specified in the template.

Complete mode deletes resources that are not in your template. Complete mode takes relatively more time than incremental mode. If the task times out, consider increasing the timeout or changing to the Incremental mode.

Warning

Complete mode will delete all the existing resources in the resource group that are not specified in the template. Do review if the resource group you're deploying to doesn't contain any necessary resources that are not specified in the template. Validate mode enables you to find problems with the template before creating actual resources.

Note

The Validate mode always creates a resource group, even if no resources are deployed. Learn more about deployment modes.


deploymentName - Deployment name
string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group.

Specifies the name of the resource group deployment to create.


deploymentOutputs - Deployment outputs
string. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group.

Provides a name for the variable for the output variable, which contains the outputs section of the current deployment object in string format. You can use the ConvertFrom-Json PowerShell cmdlet to parse the JSON object and access the individual output values. Learn more about deployment outputs.


addSpnToEnvironment - Access service principal details in override parameters
boolean. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Default value: false.

Adds the service principal ID and key of the Azure endpoint chosen to be the script's execution environment. The variables $servicePrincipalId and $servicePrincipalKey can be in override parameters, such as -key $servicePrincipalKey.


useWithoutJSON - Use individual output values without JSON.Stringify applied
boolean. Optional. Use when action = Create Or Update Resource Group || deploymentScope != Resource Group. Default value: false.

Individual output values are being converted via JSON.Stringify by default. If you want to use the output values as it is without converting them via JSON.Stringify, enable this option. For more details refer to this.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Note

This task supports Bicep files when the Azure CLI version > 2.20.0.

  • Added support for deployment at all the deployment scopes.
    • Removed all the VM related actions.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.119.1 or greater
Task category Deploy