skip to Main Content

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

2

Answers


  1. 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

    Login or Signup to reply.
  2. 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.
      • 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.

    Not sure whether the change made it to DevOps Server 2022, though, but judging from the commit and release dates, I find it likely. DevOps Server 2022 is not installed in the company I work for yet, but the upgrade is scheduled, so I will post an update as soon as I have a chance to try it. On DevOps Server 2020u1, I have verified that Bicep templates cause the task to fail while trying to parse them as JSON.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search