Azure Resource Locks

Azure Resource Locks help you protect your resources from accidental deletion or modification. By applying locks, you can ensure that critical resources remain secure and unchanged unless explicitly unlocked.

Overview

Azure Resource Locks are a feature of Azure Resource Manager designed to prevent accidental deletion or modification of your resources. Locks can be applied to resources, resource groups, or subscriptions to ensure that essential resources remain secure and intact.

Core Functionality

Lock Types

  1. ReadOnly: Authorized users can read the resource but cannot delete or update it.
  2. CanNotDelete: Authorized users can read and modify the resource but cannot delete it.

Applying Locks

  • Scope: Locks can be applied at the subscription, resource group, or individual resource level. Locks at a parent scope are inherited by all child resources.
  • Creation: In the Azure portal, navigate to the resource, select “Locks” under the “Settings” section, and add a new lock. Choose the lock type and provide a name and notes.
  • Management via CLI: Use the Azure CLI to manage resource locks. Example command to create a ReadOnly lock:
    az resource lock create --lock-type ReadOnly -n lockName -g MyResourceGroup --resource myvnet --resource-type Microsoft.Network/virtualNetworks
    

Monitoring and Management

Regularly review and manage your resource locks to ensure they meet your security requirements. Use Azure Monitor to track changes to your locks and receive alerts for unauthorized modifications.

Well-Architected Framework Considerations

Cost Optimization

Azure Resource Locks are cost-effective, with no additional cost for applying locks.

Operational Excellence

Locks automate resource protection, reducing manual intervention and improving operational efficiency.

Reliability

Locks ensure high availability and fault tolerance by protecting critical resources.

Security

Locks follow best practices, including role-based access control (RBAC) and integration with Azure Active Directory (AAD), ensuring a secure environment for your resources.

References


Last modified February 19, 2025: Update azure-point-to-site-vpn.md (a9c807a)