# Resource locks (CanNotDelete and ReadOnly)

Facts read 10 Nov 2026. Page reviewed 16 Nov 2026.

Resource locks (CanNotDelete and ReadOnly) is an Azure guardrail written in Azure resource locks. A CanNotDelete lock stops deletion and a ReadOnly lock stops updates and deletion of a subscription, resource group or resource, overriding user permissions. No documented way to test it before enforcement was found on 10 Nov 2026.

```text
CanNotDelete means authorized users can read and modify a resource, but they can't delete it.
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.

Bicep example from the documentation:
resource createRgLock 'Microsoft.Authorization/locks@2016-09-01' = {
name: 'rgLock'
properties: {
level: 'CanNotDelete'
notes: 'Resource group should not be deleted.'
}
}
```

- **Blocks:** A CanNotDelete lock stops deletion and a ReadOnly lock stops updates and deletion of a subscription, resource group or resource, overriding user permissions.
- **Breaks:** A read-only lock on a resource group that contains a virtual machine prevents all users from starting or restarting it, because those operations use POST requests. ([source](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources))
- **Test before applying:** As for every Azure resource locks guardrail: [how to test before enforcing](/mechanisms/resource-lock/)
- **Mechanism:** [Azure resource locks](/mechanisms/resource-lock/): Control plane operations on the locked scope and the resources under it
- **Taken from:** [provider documentation](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources), provider documentation

## What the source says

"ReadOnly means authorized users can read a resource, but they can't delete or update it." (read 10 Nov 2026).

On what it breaks: "A read-only lock on a resource group that contains a virtual machine prevents all users from starting or restarting a virtual machine. These operations require a POST method request."

## Related guardrails

- [Deny member accounts leaving the organization](/guardrails/aws-scp-deny-leave-org/): AWS, Service control policies (SCPs), organization integrity
- [Deny billing, tax and account contact changes](/guardrails/aws-scp-deny-billing-and-contact-changes/): AWS, Service control policies (SCPs), organization integrity
- [Restrict access to resources in a suspended OU](/guardrails/aws-rcp-restrict-suspended-ou-resources/): AWS, Resource control policies (RCPs), organization integrity
- [Do not allow deletion of resource types](/guardrails/azure-policy-deny-action-delete/): Azure, Azure Policy (built-in definitions), organization integrity
- [Deployment stack deny settings (Azure RBAC deny assignment)](/guardrails/azure-deny-assignment-deployment-stack/): Azure, Azure RBAC deny assignments (created by deployment stacks), organization integrity

## Related pages

- [Allowed locations assigned at a management group (Azure Management group assignment)](/guardrails/azure-mg-assignment-allowed-locations/)
- [Disable service account key creation (Google Cloud Organization Policy Service)](/guardrails/gcp-orgpolicy-disable-sa-key-creation/)
- [Disable automatic IAM grants for default service accounts (Google Cloud Organization Policy Service)](/guardrails/gcp-orgpolicy-no-auto-iam-grants-default-sa/)

## Sources

- Resource locks (CanNotDelete and ReadOnly): https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources (read 10 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://cloudgovernancetools.com/guardrails/azure-lock-cannotdelete-readonly/
