Resource Manager Locks provide a way for administrators to lock down Azure resources to prevent deletion of, or modifications to, a resource. These locks sit outside of the Role Based Access Controls (RBAC) hierarchy and, when applied, will place restrictions on the resource for all users. These are very useful when there is have an important resource in a subscription that users should not be able to delete or change and can help prevent accidental and malicious changes or deletion.
Perform the following in the Azure Console:
Perform the following in Azure Command Line Interface 2.0:
To lock a resource, provide the name of the resource, its resource type, and its resource group name.
az lock create –name <LockName> –lock-type <CanNotDelete/Read-only> –resource-group <resourceGroupName> –resource-name <resourceName> –resource-type <resourceType>