3

Are both AzureResourceGroupDeployment and AzureResourceManagerTemplateDeployment same?

- task: AzureResourceManagerTemplateDeployment@3
  displayName: 'deploy using AzureResourceManagerTemplateDeployment'
  inputs:    
    azureResourceManagerConnection: sc 
    subscriptionId: id
    resourceGroupName: rg
    location: $(location)    
    csmFile: ${{ parameters.root }}/Infrastructure/data/template.bicep
    csmParametersFile: env.json
    overrideParameters: '-environmentAbbreviation "env"'
    deploymentMode: 'Incremental'
    deploymentOutputs: dataoutputs

- task: AzureResourceGroupDeployment@2
  displayName: 'deploy using AzureResourceGroupDeployment'
  inputs:
    azureSubscription: ec
    resourceGroupName: rg
    csmFile: ${{ parameters.root }}/Infrastructure/data/template.bicep
    csmParametersFile: env.json
    overrideParameters: '-environmentAbbreviation "env"'
    deploymentMode: 'Incremental'
    deploymentOutputs: dataoutputs
Ecstasy
  • 1,866
  • 1
  • 9
  • 17
user989988
  • 3,006
  • 7
  • 44
  • 91

2 Answers2

2

Are both AzureResourceGroupDeployment and AzureResourceManagerTemplateDeployment same?

According to anderseide:

  • Main difference is that AzureResourceManagerTemplateDeployment contains deploymentScope, where you can select either on Management Group, Subscription or Resource Group level.

References: ARM Template Deployment Task - Deployment Scope, Azure Resource Group Deployment task and Battle of AzureResourceManagerTemplateDeployment and AzureResourceGroupDeployment

Ecstasy
  • 1,866
  • 1
  • 9
  • 17
1

AzureResourceGroupDeployment, which exists in versions 1 and 2, has been renamed in version 3 to AzureResourceManagerTemplateDeployment. They serve the same purpose, but the latter has some extra capabilities.

The differences I noticed:

  1. Added support for deployment scopes other than resource group: deploymentScope
    • As a result, the resourceGroup input is no longer required -- it is required only when deploying a resource group.
  2. Renamed service connection input: from azureSubscription to azureResourceManagerConnection
    • The alias ConnectedServiceName stayed untouched, though.
  3. Added an option to override the subscription ID specified in the service connection: subscriptionId
    • Previously, the subscription was always taken from the service connection.
    • The documentation incorrectly states that the subscriptionId input is required unless deploying to a management group. This is not true -- supplying any falsy value (including not specifying the input at all, resulting in undefined, which is falsy) triggers its load from the service connection. See the code of the task. This works OK in the YAML pipelines, but cannot be achieved in the classic pipelines, to my knowledge, because of the limitations of the UI. Thus, for classic pipelines, subscriptionId is actually required.
    • subscriptionId has an alias subscriptionName, but don't get fooled: they both accept only the GUID, not the name. This is because they directly insert the value into the URIs used for REST API calls.
  4. Removed support for the deployment of DevOps agents: enableDeploymentPrerequisites and related, many values of action

By the way, the current version of the task supports not only JSON ARM templates but also Bicep ones. The feature is implemented using Azure CLI in the background, so you should be able to control the version of Bicep via az bicep install --version ... in a script before the deployment task. Replace ... with the specific version, e.g. v0.20.4.

The necessary update to the task is available in DevOps Server 2022. On DevOps Server 2020u1, the task is available in the same major version, too, but I have verified that Bicep templates cause the task to fail while trying to parse them as JSON there.

Palec
  • 12,743
  • 8
  • 69
  • 138