Azure Resource Locks
2 minute read
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
- ReadOnly: Authorized users can read the resource but cannot delete or update it.
- 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
- Microsoft Azure Resource Locks documentation
- Azure CLI Resource Lock Commands
- Using Resource Locks to Prevent Accidental Changes in Azure
Feedback
Was this page helpful?
Glad to hear it!
Sorry to hear that.