azureazure-devopsazure-pipelinesazure-data-factoryazure-rm-template

Getting the deployment template exceeds the resource limit of 800 in Azure devops pipeline for Datafactory


During the CI/CD process for Data Factory deployment using ARM, the following task is executed:

- task: AzureResourceManagerTemplateDeployment@3
  inputs:
    deploymentScope: 'Resource Group'
    azureResourceManagerConnection: 'DEV-SC'
    subscriptionId: 'XXXXXXXXXXXXXXXXXXXXXXXXX' 
    action: 'Create Or Update Resource Group'
    resourceGroupName: 'XXXXXXXXX' 
    location: 'South India'
    templateLocation: 'Linked artifact'
    csmFile: '$(Pipeline.Workspace)/dll-adf-poc-dev-armTemplate/ARMTemplateForFactory.json'
    csmParametersFile: '$(Pipeline.Workspace)/dll-adf-poc-dev-armTemplate/ARMTemplateParametersForFactory.json'
    overrideParameters: '-factoryName $(adfName) -AzureDataLakeDev_properties_typeProperties_url $(PROD-SA)'
    deploymentMode: 'Incremental'

Error message:

Error : [error]Deployment template validation failed: 'The number of template resources limit exceeded. Limit: '800' and actual: '1012'.


Solution

  • As per the Resource Group Limits, each resource group is limited to 800 deployments in its deployment history. Once the limit of 800 deployments is reached, further deployments will not be possible. Even if you have no resources in the resource group, the deployments history would need to be cleared in order to proceed with the further deployments.

    Azure Resource Manager is supposed to automatically deletes deployments from your history as you near the limit. You can also delete the deployment history manually (using the Azure Portal) or running a Powershell or Azure CLI script.

    Locks might prevent deletions, though. In that case, remove the correspondent lock temporarily in order to delete some (or all) the deployments in the deployment history and then add the lock again.

    You can find the resource group deployments under Settings > Deployments.