Skip to content

Commit e3bf266

Browse files
authored
Merge pull request #207753 from tfitzmac/0811locks
add extension resource lock inheritance
2 parents 6d23696 + fd3a2f1 commit e3bf266

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

articles/azure-resource-manager/management/lock-resources.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
title: Protect your Azure resources with a lock
33
description: You can safeguard Azure resources from updates or deletions by locking all users and roles.
44
ms.topic: conceptual
5-
ms.date: 08/08/2022
5+
ms.date: 08/11/2022
66
ms.custom: devx-track-azurecli, devx-track-azurepowershell
77
---
88

99
# Lock your resources to protect your infrastructure
1010

1111
As an administrator, you can lock an Azure subscription, resource group, or resource to protect them from accidental user deletions and modifications. The lock overrides any user permissions.
1212

13-
You can set locks that prevent either deletions or modifications. In the portal, these locks are called **Delete** and **Read-only**. In the command line, these locks are called **CanNotDelete** and **ReadOnly**. In the left navigation panel, the subscription lock feature's name is **Resource locks**, while the resource group lock feature's name is **Locks**.
13+
You can set locks that prevent either deletions or modifications. In the portal, these locks are called **Delete** and **Read-only**. In the command line, these locks are called **CanNotDelete** and **ReadOnly**.
1414

1515
- **CanNotDelete** means authorized users can read and modify a resource, but they can't delete it.
1616
- **ReadOnly** means authorized users can read a resource, but they can't delete or update it. Applying this lock is similar to restricting all authorized users to the permissions that the **Reader** role provides.
@@ -21,13 +21,27 @@ Unlike role-based access control (RBAC), you use management locks to apply a res
2121

2222
When you apply a lock at a parent scope, all resources within that scope inherit the same lock. Even resources you add later inherit the same parent lock. The most restrictive lock in the inheritance takes precedence.
2323

24+
[Extension resources](extension-resource-types.md) inherit locks from the resource they're applied to. For example, Microsoft.Insights/diagnosticSettings is an extension resource type. If you apply a diagnostic setting to a storage blob, and lock the storage account, you're unable to delete the diagnostic setting. This inheritance makes sense because the full resource ID of the diagnostic setting is:
25+
26+
```json
27+
/subscriptions/{sub-id}/resourceGroups/{rg-name}/providers/Microsoft.Storage/storageAccounts/{storage-name}/blobServices/default/providers/microsoft.insights/diagnosticSettings/{setting-name}"
28+
```
29+
30+
Which matches the scope of the resource ID of the resource that is locked:
31+
32+
```json
33+
/subscriptions/{sub-id}/resourceGroups/{rg-name}/providers/Microsoft.Storage/storageAccounts/{storage-name}
34+
```
35+
2436
If you have a **Delete** lock on a resource and attempt to delete its resource group, the feature blocks the whole delete operation. Even if the resource group or other resources in the resource group are unlocked, the deletion doesn't happen. You never have a partial deletion.
2537

2638
When you [cancel an Azure subscription](../../cost-management-billing/manage/cancel-azure-subscription.md#what-happens-after-subscription-cancellation):
2739
* A resource lock doesn't block the subscription cancellation.
2840
* Azure preserves your resources by deactivating them instead of immediately deleting them.
2941
* Azure only deletes your resources permanently after a waiting period.
3042

43+
44+
3145
## Understand scope of locks
3246

3347
> [!NOTE]
@@ -101,6 +115,8 @@ To delete everything for the service, including the locked infrastructure resour
101115

102116
### Portal
103117

118+
In the left navigation panel, the subscription lock feature's name is **Resource locks**, while the resource group lock feature's name is **Locks**.
119+
104120
[!INCLUDE [resource-manager-lock-resources](../../../includes/resource-manager-lock-resources.md)]
105121

106122
### Template

0 commit comments

Comments
 (0)