Read a sample: 1. Resource Locks in the Administrator's Toolkit
A shared Azure environment is rarely still. Administrators deploy resources, adjust settings, investigate incidents, and remove services that are no longer needed. Much of that work is routine. The difficulty is that a routine action against the wrong resource can have consequences far beyond the person who selected it.
Consider a fictional organization called Northwind Field Services. Its cloud team supports several internal applications in a shared Azure subscription. One resource group contains services used by an operations dashboard; another holds a temporary testing environment. Their names are similar enough that a busy administrator might confuse them, particularly when cleaning up resources after a project.
The team wants to reduce the chance that someone deletes the dashboard’s resources during an unrelated cleanup. Its administrators already have permissions appropriate to their jobs, but those permissions do not necessarily distinguish a careful deletion from a mistaken one. Northwind needs an additional administrative safeguard: a way to make certain management operations stop until someone deliberately addresses the protection in place.
An Azure resource lock can provide that safeguard. A lock is a management-plane restriction applied at a chosen scope. Depending on its type, it can prevent deletion or restrict management changes to the protected scope and resources beneath it. It does not replace judgment or a change process, but it makes an important boundary visible when a protected operation is attempted.
This chapter introduces the role of locks before examining their mechanics in detail. The central question is not simply, “Can we put a lock on this resource?” It is, “What mistake are we trying to make less likely, and what legitimate work must still be possible?”
Northwind’s administrators often work with resources that belong to other teams. A support engineer might investigate a networking issue, while a deployment engineer updates an application component. A cleanup task might involve deleting an entire resource group after confirming that its contents are no longer needed.
Without an additional restriction, a person with the necessary Azure permissions can attempt those operations. A resource lock adds a separate check for covered management operations. If the operation conflicts with an applicable lock, Azure can block it even when the person otherwise has permission to perform it.
Think of the lock as a speed bump rather than a vault. It interrupts an action and gives the team an opportunity to confirm intent. An administrator who is authorized to manage the relevant lock can remove it when an approved task requires that step. The lock therefore supports an administrative process; it does not make a resource permanently untouchable.
For Northwind, that distinction is useful. The team does not want to prevent all maintenance on the dashboard. It wants a mistaken deletion attempt to encounter a deliberate obstacle. When the dashboard eventually needs to be retired, the team can review the request, locate the lock, and arrange for an authorized person to remove it as part of the approved work.
Locks are particularly valuable when their presence communicates a meaningful decision. A lock named and documented in a way that identifies the protected service and its owner is easier to interpret than an unexplained restriction discovered during an incident. The technical control and the information around it should help the next administrator understand why the boundary exists.
Azure management locks provide two principal choices: CanNotDelete and ReadOnly. They solve related but different problems.
A CanNotDelete lock is intended to prevent deletion at the protected scope. It does not, by itself, prohibit every modification. A team choosing this lock is saying that deletion should encounter an additional barrier, while other management changes may still be appropriate.
That makes CanNotDelete a plausible starting point for Northwind’s dashboard resource group. The team wants to protect the service from an accidental cleanup but expects authorized administrators to perform ordinary configuration work. The lock does not determine which configuration changes are wise or who should make them; it addresses the deletion risk.
A ReadOnly lock is more restrictive. It restricts management operations that would change or delete the protected resources. The name can suggest that anything an administrator thinks of as “reading” will work, but Azure evaluates the operation, not merely the user’s intention. For example, a ReadOnly lock on a storage account blocks the management-plane List Keys operation because that operation uses POST. This is not a blanket rule for data-plane reads. Check the current Microsoft documentation for each service operation used by an important workflow rather than inferring behavior from a button’s label.
Northwind might consider ReadOnly for a stable resource whose configuration should not normally change. Before applying it, the team should check whether maintenance, deployment, or support procedures need operations the lock would restrict.
The distinction matters because a stronger restriction is not automatically a better one. A lock that unnecessarily disrupts legitimate work may create pressure to remove it routinely or encourage poorly planned exceptions. The useful choice is the one that addresses the identified risk while fitting the resource’s operating requirements.
Resource locks are one part of a broader administrative toolkit. Their purpose becomes clearer when separated from three neighboring concerns.
Access control answers who is allowed to perform an operation. Azure role-based access control, commonly called Azure RBAC, grants permissions through role assignments. A lock adds a restriction at a scope; it can block a covered operation even when an RBAC assignment otherwise permits it. Conversely, removing a lock…