Practice Exams:

Microsoft AZ-104: Azure Resource Locks

Cloud & Architecture

Azure resource locks are guardrails against accidental management operations, not a replacement for least-privilege access, backups or recovery planning. Knowing precisely what a lock blocks—and what it does not—is essential before applying one to a production estate. A delete lock may prevent one management operation while leaving data-plane behavior and other forms of loss unaffected. Test the intended protection with a representative resource and document how an authorized operator removes it during maintenance.

On this page
  1. Name the accident you want to prevent
  2. Distinguish CanNotDelete and ReadOnly effects
  3. Understand inheritance and scope before broad deployment
  4. Separate management-plane locks from data access
  5. Design a controlled maintenance and exception process
  6. Verify the guardrail with deliberately safe tests
  7. Decide where locks fit with policy, RBAC and recovery
  8. Use an Azure resource lock without blocking a critical restoration

Start by identifying the operation a lock should block: accidental deletion of a shared resource, a configuration change during maintenance, or automated cleanup targeting a production dependency. Test that exact management-plane request with and without the lock, and document who may remove it in an emergency. In a Microsoft AZ-104 lab, the useful evidence is the denied operation and the safe recovery procedure, not simply the presence of a configured lock.

Name the accident you want to prevent

A platform engineer can have legitimate permissions and still target the wrong resource during a cleanup or deployment. Deleting a critical resource group or changing a key infrastructure component can disrupt many applications. Locks add an explicit management boundary to such operations, including for users whose role might otherwise permit the action.

Start with the failure scenario. Is the concern deletion of a shared DNS zone, accidental removal of a recovery vault, or any configuration change to a stable critical service? These are not identical risks. A policy designed to prevent the first two may require a different lock setting from one aimed at preventing all write operations. Applying a blanket lock everywhere may block ordinary maintenance without protecting the data path that matters.

Document the resource owner, desired guardrail, emergency removal authority and a review date. A useful record says why the lock exists and what operations it affects. Do not rely on a vague description such as “security lock” that leaves incident responders unsure whether unlocking it is safe.

Distinguish CanNotDelete and ReadOnly effects

Azure supports management locks commonly called Delete and Read-only in the portal, corresponding to CanNotDelete and ReadOnly configuration values. According to Microsoft’s resource lock guidance, a delete lock allows authorized management changes but prevents deletion of its target, while a read-only lock blocks supported management write and delete operations. These controls operate through Azure Resource Manager authorization, not by changing every application data permission.

A team might want to stop accidental deletion of a shared production storage account while still allowing approved management updates. A delete lock could align with that objective. On a rarely modified networking component, a read-only lock may be warranted, but it can block seemingly harmless updates or operations that internally issue a management write request. Always test the actual supported workload behavior.

The lock overrides a user’s otherwise sufficient Azure role for blocked management operations. However, users with appropriate permission to manage locks can remove the guardrail. The access required to add or delete a lock is therefore a distinct privileged capability that should be closely controlled and monitored. A lock alone cannot protect against a malicious administrator who can remove it.

Understand inheritance and scope before broad deployment

Locks can be applied to subscriptions, resource groups and individual resources. A lock at a broader scope is inherited by descendants according to Resource Manager semantics. A delete lock on a resource group can stop deletion of the resource group and covered child resources, even when an operator is authorized to modify other properties of those resources.

Inheritance is especially important for platform groups containing unrelated resources. A read-only lock on a whole group may unintentionally prevent an application team from scaling infrastructure, rotating settings or maintaining monitoring components. Choose the narrowest scope that protects the intended failure mode, unless all descendants genuinely require the same boundary.

Before applying a parent lock, inventory child resources and expected maintenance operations. Test the intended control and at least two legitimate operations that should still work. If a lock prevents a required backup policy adjustment or application deployment, revise the scope or establish a tightly governed maintenance procedure instead of telling engineers to disable the lock ad hoc.

Separate management-plane locks from data access

One of the most important distinctions is management plane versus data plane. Resource Manager locks govern management operations; they do not universally prevent a user or application with data-plane permissions from changing or deleting objects stored inside a service. A delete lock on a storage account is not proof that all blobs within it are immutable or cannot be removed by an authorized client.

Data protection requires workload-specific controls. For storage, evaluate supported data access policies, versioning, soft delete and immutability rules where the threat model requires them. For databases, assess transactional authorization, retention and recovery. A guardrail that protects a service resource from accidental deletion should be combined with recovery and backup design when the underlying data has its own destruction and corruption risks.

Some services expose actions through Resource Manager that look like reads from a user perspective but are implemented as management writes. A read-only lock can block such operations. Verify the service’s documented interactions rather than assuming that all list, connect or diagnostic actions will remain usable under the lock.

Design a controlled maintenance and exception process

Operational teams must occasionally change or remove protected resources. A safe process identifies who may unlock, exactly why, the affected scope, the expected maintenance action and the re-lock deadline. Use a change ticket or privileged access approval that creates traceable evidence; a shared permanent Owner account undermines the protection.

For an approved change, verify the lock type and scope, perform a before-state snapshot where applicable, remove or adjust the lock temporarily under authorization, apply the change, and reinstate the intended lock. Record the final lock configuration and whether the change left any unexpected child resources outside protection. An automated workflow may simplify these steps, but must fail safely if the re-lock action is skipped or fails.

Emergency access should be tested in a nonproduction environment. If the lock prevents restoring an essential component during a real incident, responders need a documented, auditable override path. Avoid rules that force an operator to choose between a prolonged outage and an untraceable security exception.

Verify the guardrail with deliberately safe tests

A lock is effective only if the intended blocked action is actually denied at the correct scope. In a test resource group, apply a delete lock to a disposable resource and attempt its deletion with a role that normally permits it. Observe the Resource Manager response, confirm the resource still exists and record the failure in a control test. Never run destructive validation against a critical production resource just to prove the lock exists.

Also test permitted operations. Under a delete lock, an approved configuration update may still succeed; a read-only lock should block applicable changes. These checks help distinguish a lock from Azure RBAC authorization errors or policy deny rules. A deployment can fail due to inherited Azure Policy, insufficient role permissions, wrong API version or locks, and each cause requires a different fix.

Use the resource Activity Log and change records to detect lock changes, attempted deletions and unexpected privilege grants. A monitoring alert on removing a production lock can be particularly useful when a maintenance exception is legitimate but should be visible to an independent operations or security reviewer.

Decide where locks fit with policy, RBAC and recovery

Locks, Azure Policy and RBAC solve different problems. RBAC determines who may attempt management actions, Policy evaluates resources and certain requests against organizational rules, and locks block specified management operations even for authorized users. Backup or replication provides an ability to recover after a disruptive event. No one mechanism covers all the others.

Consider a shared production network component. Restrict changes through RBAC, enforce an approved configuration through policy where supported, apply a deletion guardrail if the risk justifies it, and retain a tested infrastructure-as-code rebuild and recovery procedure. This design reduces both the chance of an accidental mistake and the time to recover if something escapes prevention.

Before adding a lock, record the exact deletion or modification failure it is meant to prevent and identify which authorized maintenance actions must remain possible. Test both an ordinary operator and the approved lock-removal procedure in a safe scope. The best lock prevents a narrow, high-cost mistake without giving teams false confidence about data-plane operations or blocking essential recovery work.

Use an Azure resource lock without blocking a critical restoration

A finance service uses a shared resource group containing production storage and monitoring. An operator accidentally deleted a test resource elsewhere and proposes placing a ReadOnly lock across the entire production group. The lock might stop some necessary management operations during an incident, while it does not substitute for data backup or protection from data-plane changes. Define the specific destructive action being prevented and test the management-plane side effects in a nonproduction equivalent first.

For the production storage account, a narrowly scoped CanNotDelete lock may be more proportionate than a blanket read-only restriction, but only after verifying deployment, scaling and recovery procedures that must still succeed. Record who may remove the lock in an emergency, how the removal is approved, and how the lock is restored afterward. Test the exception route with a scheduled change, not for the first time during a widespread outage.

An administrator should attempt an authorized safe modification and a simulated deletion using the intended account permissions, recording the resulting behavior. Separately verify access controls, policy, backups and recovery objectives. The effective control is a layered system that prevents a known mistake without making legitimate repair impossible.

Continue learning

Related guides

Subscriptions, Azure Policy, and Resource LocksSee how subscriptions, Azure Policy, and locks constrain deployments.Azure Policy Initiatives for Platform TeamsBundle Azure Policy controls with exclusions and remediation.Azure Resource Groups: Design Around OperationsGroup resources by lifecycle, ownership, and deployment boundaries.

Related Posts

• Top Cloud Certifications Valuable in 2022: Is Microsoft a Leader?

• Conquer the Cloud: Your Beginner’s Blueprint for Microsoft Azure Mastery

• Cloud-Native App Architecture Using Microsoft Azure Cosmos DB

• Cloud Confidence Starts Here: A Four-Part AZ-900 Certification Blueprint

• Microsoft AZ-104: Azure Monitor Alerts

• Microsoft AZ-104: Troubleshoot Azure VMs

• Microsoft AZ-104: Subscriptions, Policy, and Locks

• Microsoft AZ-900: Shared Responsibility by Cloud Service Model

• Microsoft AZ-104: Azure RBAC for Platform Teams

• Microsoft AZ-104: Azure Management Groups