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
According to anderseide:
AzureResourceManagerTemplateDeployment
containsdeploymentScope
, where you can select either onManagement Group
,Subscription
orResource Group
level.References: ARM Template Deployment Task – Deployment Scope, Azure Resource Group Deployment task and Battle of AzureResourceManagerTemplateDeployment and AzureResourceGroupDeployment
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:
deploymentScope
resourceGroup
input is no longer required — it is required only when deploying a resource group.azureSubscription
toazureResourceManagerConnection
ConnectedServiceName
stayed untouched, though.subscriptionId
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 inundefined
, which is falsy) triggers its load from the service connection. See the code of the task.subscriptionId
has an aliassubscriptionName
, 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.enableDeploymentPrerequisites
and related, many values ofaction
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.