FREE STUDY NOTES · AZ-104

Azure resource locks: CanNotDelete vs ReadOnly

What delete and read-only locks block, how they inherit, and the surprising things a ReadOnly lock stops (like listing storage keys).

From Ultra Transcenders AZ-104 by Tony Rough

Locks protect resources from accidental deletion or change, regardless of the RBAC permissions of the person making the change. There are only two levels, and they differ in what they allow.

Lock Read Modify / create in scope Delete Move into or out of a resource group
CanNotDelete (Delete) Yes Yes (for example, deploy a VM into the resource group) No Allowed
ReadOnly Yes No No Blocked when on the source or target resource group or subscription

Common trap: Assuming any lock stops resources moving into or out of a resource group - only a ReadOnly lock on the source or target resource group or subscription blocks a move; a CanNotDelete lock, or any lock on the individual resource, doesn’t.

A ReadOnly lock on a storage account also blocks the List Keys operation (it is a POST, and ReadOnly blocks all POST operations), so users can no longer read the access keys and must use Microsoft Entra credentials for blob or queue data; clients that already hold a key can keep using it. (See Figure 3.1.)

A grid compares the two lock levels: CanNotDelete blocks only deletion, while ReadOnly blocks changes, deletion, listing storage keys and moves when it sits on the source or target resource group or subscription. Below, locks pass down from subscription to resource group to resource (management groups can't take one), and a move is blocked only by a ReadOnly lock on either group or the subscription, never by a lock on the resource itself.
Figure 3.1: What CanNotDelete and ReadOnly locks block, where they apply, and when they stop a move

Get the whole book

This note is one section of Ultra Transcenders AZ-104: Microsoft Azure Administrator, an independent study guide that explains every topic the exam covers by technology, with comparison tables, diagrams and the common traps, plus a glossary linked to Microsoft Learn.

Amazon.co.ukKindlePaperback
Amazon.comKindlePaperback

Opens Amazon in a new tab.

About the book · Free AZ-104 glossary · All AZ-104 study notes

More AZ-104 study notes