AZ-900 ยท Governance and compliance
Resource locks
CanNotDelete (Delete) and ReadOnly locks, applying them at subscription, resource group or resource, inheritance, and that even owners must remove a lock first.
Key points
- Two levels: CanNotDelete ("Delete" in the portal) allows reads and changes but blocks deletion; ReadOnly ("Read-only") allows reads only.
- Locks can be set on a subscription, resource group or resource, are inherited by everything below, and apply to all users and roles: even an Owner must remove the lock first.
Source: https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources
Practice questions
Which lock lets users keep changing a resource but stops anyone from deleting it?
- ReadOnly
- CanNotDelete
- NoModify
- Reader
Show answer
Answer: B. CanNotDelete
CanNotDelete allows reads and modifications but blocks deletion. ReadOnly blocks changes as well; the Reader role is RBAC, not a lock.
At which scopes can you apply a resource lock?
- Subscription
- Resource group
- Individual resource
- Management group
- Microsoft Entra tenant
Show answer
Answer: A. Subscription, B. Resource group, C. Individual resource
Locks can be placed on a subscription, a resource group or a single resource. Management groups cannot be locked, and a Microsoft Entra tenant is not an Azure Resource Manager scope for locks.
A user with the Owner role can delete a resource that has a CanNotDelete lock without removing the lock first.
Show answer
Answer: False
False. Locks apply to all users and roles and override permissions; the Owner can remove the lock, but the delete only works after that.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
