You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/deployment-history-deletions.md
+31-20Lines changed: 31 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,65 +2,76 @@
2
2
title: Deployment history deletions
3
3
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.
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.
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](./deploy-to-resource-group.md), [subscription](./deploy-to-subscription.md), [management group](./deploy-to-management-group.md), [tenant](./deploy-to-tenant.md)—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 was implemented on **August 6, 2020**.
14
12
15
13
> [!NOTE]
16
14
> Deleting a deployment from the history doesn't affect any of the resources that were deployed.
17
15
18
-
## When deployments are deleted
16
+
## Overview of automatic deployment history deletions
19
17
20
18
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.
21
19
22
20
:::image type="content" border="false" source="./media/deployment-history-deletions/deployment-history.png" alt-text="Diagram of deployment history deletion.":::
23
21
24
22
> [!IMPORTANT]
25
-
> 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.
26
24
27
25
In addition to deployments, you also trigger deletions when you run the [what-if operation](./deploy-what-if.md) or validate a deployment.
28
26
29
27
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.
30
28
31
-
## Remove locks that block deletions
29
+
## Permissions required for automatic deletions
30
+
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
+
## Handling resource locks
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 need to remove the lock.
32
38
33
-
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.
39
+
To delete a resource grouplock, run the following commands:
34
40
35
-
To use PowerShell to delete a lock, run the following commands:
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.
If the current user doesn't have the required permissions, automatic deletion is attempted again during the next deployment.
63
+
---
54
64
55
-
## Opt out of automatic deletions
65
+
## Opting out of automatic deletions
56
66
57
-
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.
67
+
You can opt out of automatic deletion to manually manage your deployment history. **Use this option cautiously**, as the **800-deployment limit**remains enforced, and exceeding it causes deployment failures.
58
68
59
-
To disable automatic deletions at the tenant or the management group scope, open a support ticket. For the instructions, see [Request support](./overview.md#get-support).
69
+
> [!IMPORTANT]
70
+
> Opting out is available only for subscription scopes, as it's controlled by the subscription-level `Microsoft.Resources/DisableDeploymentGrooming` feature flag. You can't opt out for only a particular resource group. For tenant or management group scopes, open a [support ticket](./overview.md#get-support) to disable automatic deletion.
60
71
61
-
To disable automatic deletions at the subscription scope, 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. To reenable automatic deletions, unregister the feature flag.
72
+
To disable automatic deletion at the subscription scope (affects all resource groups within it):
62
73
63
-
# [PowerShell](#tab/azure-powershell)
74
+
###[PowerShell](#tab/azure-powershell)
64
75
65
76
For PowerShell, use [Register-AzProviderFeature](/powershell/module/az.resources/Register-AzProviderFeature).
Copy file name to clipboardExpand all lines: includes/azure-resource-groups-limits.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,7 @@ ms.topic: include
5
5
ms.date: 10/25/2024
6
6
ms.author: jgao
7
7
---
8
+
8
9
| Resource | Limit |
9
10
| --- | --- |
10
11
| Resources per [resource group](../articles/azure-resource-manager/management/overview.md#resource-groups)| Resources aren't limited by resource group. Instead, they're limited by resource type in a resource group. See next row. |
Copy file name to clipboardExpand all lines: includes/management-group-limits.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,10 @@
18
18
| Direct parent management group per management group | One |
19
19
|[Management group level deployments](../articles/azure-resource-manager/templates/deploy-to-management-group.md) per location | 800<sup>2</sup> |
20
20
| 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> |
21
22
22
23
<sup>1</sup>The 6 levels don't include the subscription level.
23
24
24
25
<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