Automatic deletions from deployment history
Every time you deploy a template, information about the deployment is written to the deployment history. Each resource group is limited to 800 deployments in its deployment history.
Azure Resource Manager will soon start automatically deleting deployments from your history as you near the limit. Automatic deletion is a change from past behavior. Previously, you had to manually delete deployments from the deployment history to avoid getting an error.
Deleting a deployment from the history doesn't affect any of the resources that were deployed.
If you have a CanNotDelete lock on a resource group, the deployments for that resource group can't be deleted. You must remove the lock to take advantage of automatic deletions in the deployment history.
When deployments are deleted
Deployments are deleted from your deployment history when you reach 790 deployments. Azure Resource Manager deletes a small set of the oldest deployments to clear space for future deployments. Most of your history remains unchanged. The oldest deployments are always deleted first.
In addition to deployments, you also trigger deletions when you run the what-if operation or validate a deployment.
When you give a deployment the same name as one in the history, you reset its place in the history. The deployment moves to the most recent place in the history. You also reset a deployment's place when you roll back to that deployment after an error.
If your resource group is already at the 800 limit, your next deployment fails with an error. The automatic deletion process starts immediately. You can try your deployment again after a short wait.
Opt out of automatic deletions
You can opt out of automatic deletions from the history. Use this option only when you want to manage the deployment history yourself. The limit of 800 deployments in the history is still enforced. If you exceed 800 deployments, you'll receive an error and your deployment will fail.
To disable automatic deletions, register the
Microsoft.Resources/DisableDeploymentGrooming feature flag. When you register the feature flag, you opt out of automatic deletions for the entire Azure subscription. You can't opt out for only a particular resource group.
For PowerShell, use Register-AzProviderFeature.
Register-AzProviderFeature -ProviderNamespace Microsoft.Resources -FeatureName DisableDeploymentGrooming
To see the current status of your subscription, use:
Get-AzProviderFeature -ProviderNamespace Microsoft.Resources -FeatureName DisableDeploymentGrooming
- To learn about viewing the deployment history, see View deployment history with Azure Resource Manager.