Resolve error when deployment count exceeds 800
Each resource group is limited to 800 deployments in its deployment history. This article describes the error you receive when a deployment fails because it would exceed the allowed 800 deployments. To resolve this error, delete deployments from the resource group history. Deleting a deployment from the history doesn't affect any of the resources that were deployed.
Azure Resource Manager automatically deletes deployments from your history as you near the limit. You may still see this error for one of the following reasons:
- You have a CanNotDelete lock on the resource group that prevents deletions from the deployment history.
- You opted out of automatic deletions.
- You have a large number of deployments running concurrently and the automatic deletions aren't processed fast enough to reduce the total number.
For information about how to remove a lock or opt in to automatic deletions, see Automatic deletions from deployment history.
This article describes how to manually delete deployments from the history.
During deployment, you receive an error that states the current deployment will exceed the quota of 800 deployments.
Use the az deployment group delete command to delete deployments from the history.
az deployment group delete --resource-group exampleGroup --name deploymentName
To delete all deployments older than five days, use:
startdate=$(date +%F -d "-5days") deployments=$(az deployment group list --resource-group exampleGroup --query "[?properties.timestamp<'$startdate'].name" --output tsv) for deployment in $deployments do az deployment group delete --resource-group exampleGroup --name $deployment done
You can get the current count in the deployment history with the following command. This example requires a Bash environment.
az deployment group list --resource-group exampleGroup --query "length(@)"