Skip to content

Commit 2f4d11e

Browse files
committed
clarify auto delete scopes
1 parent 549e069 commit 2f4d11e

File tree

2 files changed

+18
-29
lines changed

2 files changed

+18
-29
lines changed

articles/azure-resource-manager/templates/deployment-history-deletions.md

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,55 @@
22
title: Deployment history deletions
33
description: Describes how Azure Resource Manager automatically deletes deployments from the deployment history. Deployments are deleted when the history is close to exceeding the limit of 800.
44
ms.topic: conceptual
5-
ms.date: 05/21/2025
5+
ms.date: 05/22/2025
66
ms.custom: devx-track-azurecli, devx-track-arm-template
77
---
88

99
# Automatic deletions from deployment history
1010

11-
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.
12-
13-
Azure Resource Manager automatically deletes 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. This change was implemented on August 6, 2020.
14-
15-
16-
17-
18-
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.
19-
20-
Azure Resource Manager automatically deletes deployments from your history as you near the limit. **Automatic deployment deletion applies to all scopes: resource group, subscription, and management group.** Automatic deletion is a change from past behavior. Previously, you had to manually delete deployments from the deployment history to avoid getting an error. This change was implemented on August 6, 2020.
21-
22-
23-
24-
25-
11+
When you deploy resources to Azure, the deployment details are recorded in the deployment history at the scope where the deployment occurs. Each scope — whether it's a resource group, subscription, or management group—can store up to **800 deployments** in its history. Once this limit is reached, Azure **automatically deletes the oldest deployments** to make space for new ones. This automatic cleanup process has been in effect since **August 6, 2020**.
2612

2713
> [!NOTE]
2814
> Deleting a deployment from the history doesn't affect any of the resources that were deployed.
2915
30-
## When deployments are deleted
16+
## How automatic deployment deletions work
3117

3218
Deployments are deleted from your history when you exceed 700 deployments. Azure Resource Manager deletes deployments until the history is down to 600. The oldest deployments are always deleted first.
3319

3420
:::image type="content" border="false" source="./media/deployment-history-deletions/deployment-history.png" alt-text="Diagram of deployment history deletion.":::
3521

3622
> [!IMPORTANT]
37-
> 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.
23+
> If your scope 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.
3824
3925
In addition to deployments, you also trigger deletions when you run the [what-if operation](./deploy-what-if.md) or validate a deployment.
4026

4127
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](rollback-on-error.md) after an error.
4228

43-
## Remove locks that block deletions
29+
## Permissions required for automatic deletions
4430

45-
If you have a [CanNotDelete lock](../management/lock-resources.md) 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.
31+
The deletions are requested under the identity of the user who deployed the template. To delete deployments, the user must have access to the **Microsoft.Resources/deployments/delete** action. If the user doesn't have the required permissions, deployments aren't deleted from the history.
32+
33+
If the current user doesn't have the required permissions, automatic deletion is attempted again during the next deployment.
34+
35+
## Removing locks that block deletions
36+
37+
If you have a [CanNotDelete lock](../management/lock-resources.md) on a resource group or a subscription, the deployments for that scope can't be automatically deleted. To enable automatic cleanup of the deployment history, you'll need to remove the lock.
4638

47-
To use PowerShell to delete a lock, run the following commands:
39+
To delete a resource group lock using Azure PowerShell, run the following commands:
4840

4941
```azurepowershell-interactive
5042
$lockId = (Get-AzResourceLock -ResourceGroupName lockedRG).LockId
5143
Remove-AzResourceLock -LockId $lockId
5244
```
5345

54-
To use Azure CLI to delete a lock, run the following commands:
46+
To delete a resource group lock using Azure CLI, run the following commands:
5547

5648
```azurecli-interactive
5749
lockid=$(az lock show --resource-group lockedRG --name deleteLock --output tsv --query id)
5850
az lock delete --ids $lockid
5951
```
6052

61-
## Required permissions
62-
63-
The deletions are requested under the identity of the user who deployed the template. To delete deployments, the user must have access to the **Microsoft.Resources/deployments/delete** action. If the user doesn't have the required permissions, deployments aren't deleted from the history.
64-
65-
If the current user doesn't have the required permissions, automatic deletion is attempted again during the next deployment.
66-
67-
## Opt out of automatic deletions
53+
## How to opt out of automatic deletions
6854

6955
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.
7056

includes/management-group-limits.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
| Direct parent management group per management group | One |
1919
| [Management group level deployments](../articles/azure-resource-manager/templates/deploy-to-management-group.md) per location | 800<sup>2</sup> |
2020
| Locations of [Management group level deployments](../articles/azure-resource-manager/templates/deploy-to-management-group.md) | 10 |
21+
| Deployments per management group in the deployment history |800<sup>3</sup> |
2122

2223
<sup>1</sup>The 6 levels don't include the subscription level.
2324

2425
<sup>2</sup>If you reach the limit of 800 deployments, delete deployments from the history that are no longer needed. To delete management group level deployments, use [Remove-AzManagementGroupDeployment](/powershell/module/az.resources/Remove-AzManagementGroupDeployment) or [az deployment mg delete](/cli/azure/deployment/mg#az-deployment-mg-delete).
26+
27+
<sup>3</sup>Deployments are automatically deleted from the history as you near the limit. Deleting an entry from the deployment history doesn't affect the deployed resources. For more information, see [Automatic deletions from deployment history](../articles/azure-resource-manager/templates/deployment-history-deletions.md).

0 commit comments

Comments
 (0)