Mission-critical Azure resources should carry a resource lock
This check looks for management locks on the Azure resources, resource groups or subscriptions you treat as mission-critical. The safe setting is a lock, normally Delete (CanNotDelete), so nobody can remove them by accident.
Why it matters
A management lock overrides user permissions. Even an Owner cannot delete a locked resource until the lock itself is removed, which is a separate, deliberate step. That protects databases, key stores, networking and shared services from a mistaken click, a bad script, or an account that has been taken over.
Locks are inherited: a lock on a resource group covers everything inside it, including resources added later. Microsoft documents two levels, CanNotDelete (read and modify, but not delete) and ReadOnly (read only).
Source: Microsoft Learn, Lock your Azure resources to protect your infrastructure.
How to check it yourself
Portal: open the resource, resource group or subscription, then Settings > Locks (for a subscription the entry is called Resource locks). Read-only commands:
az lock list --output table
az lock list --resource-group --output table Azure PowerShell equivalent: Get-AzResourceLock. Compare the list with your own list of resources that would hurt to lose.
How to fix it
Portal: on the resource or resource group choose Locks > Add, give the lock a name, select the Delete level, and save. You need the Owner or User Access Administrator role, or another role with Microsoft.Authorization/locks permissions.
Script (run by an admin, not by ConfigCobra):
az lock create --name protect-critical --lock-type CanNotDelete --resource-group ConfigCobra itself never changes your Azure environment. Prefer a Delete lock first; use ReadOnly only where you are sure nothing needs to change.
What changes when you fix it
Nobody, including owners, can delete the locked scope until the lock is removed, and a delete of a resource group that contains a locked resource fails as a whole. A ReadOnly lock goes further and has side effects Microsoft lists: for example, on a storage account it blocks listing access keys, and on a resource group holding a virtual machine it prevents starting or restarting it. Locks apply to control-plane operations only, so they do not protect data inside a storage account or database. Tell platform and deployment teams, since pipelines that delete and recreate resources will need to remove the lock first.
Included in
| Benchmark | CIS ID | Profile |
|---|---|---|
| CIS Microsoft Azure Foundations v6.0.0 | 6.2 | Level 2 |
Go further
Check this on your Microsoft Azure
ConfigCobra runs this check with every other control of the CIS Microsoft Azure Benchmarks, read-only.