Microsoft Azure: Prevent Accidental Deletion by Locking Resources
Azure has role-based access control (RBAC) to restrict access to resources and management features, and while an important feature, it can’t be used to quickly prevent all users from accidentally deleting a resource. There may be times when you want to protect a resource from accidental deletion, or prevent unwanted changes, even when users have high-level access to the resource.
For more information on Microsoft Azure, see What is Microsoft Azure? on the Petri IT Knowledgebase.
Locks come in two forms: Read-only and Delete; and can only be created or deleted by users that are assigned Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions, and this includes the Owner and User Access Administrator roles.
- Read-only: No changes can be made to a resource.
- Delete: Resource cannot be deleted.
Applying read-only locks should be done with care as they can have unpredictable results. For example, some resource types, such as storage accounts, require that users can write to them under normal operating circumstances. Locks can be applied to resource groups, and any child objects automatically inherit the lock from the parent. Additionally, the most restrictive lock always takes precedence.
Apply Locks to Resources
To complete the instructions below, you’ll need to have Owner or User Access Administrator access to an Azure subscription.
- Log in to the Azure management portal here with your Microsoft, or work or school account.
- In the list of options on the left of the portal window, click All resources.
- In the list of resources, click the resource you want to apply a lock to.
Alternatively, you can select Resource groups, select a resource group, and apply a lock to it. Not forgetting that any child objects will inherit the lock applied to the resource group.
- In the resource panel under Settings, click Locks.
- In the Locks pane, click + Add.
- Give the lock a name, and then select Read-only or Delete from the Lock type menu.
- Optionally, give the lock a description in the Notes field.
- To complete the process, click OK.
The new lock will now appear in the list.
To see all the locks in your subscription, click Subscription at the top of the Locks pane. You can also see all the locks associated with a resource group by clicking Resource group at the top of the locks pane. To delete a lock, right click the three dots (…) to the right of the lock and select Delete from the menu.
More in Cloud Computing
What Are the Best Hyperconverged Infrastructure (HCI) Solutions on the Market?
Jan 9, 2023 | Sukesh Mudrakola
Amazon Cuts 18,000 Jobs From its Global Workforce
Jan 9, 2023 | Michael Otey
Using Autodesk Drive to Collaborate on Design and Model Data in the Cloud
Jan 6, 2023 | Siji Roy
Amazon Web Services (AWS): A 2022 FAQ
Dec 22, 2022 | Michael Otey
Microsoft to Roll Out EU Data Boundary Plan for Cloud Services on January 1
Dec 15, 2022 | Rabia Noureen
What Are Azure ArcBox and Azure Stack HCI Jumpstart?
Dec 14, 2022 | Flo Fox
Most popular on petri