DEV Community

Cover image for How to Lock a Resource group in Azure
Adisa Oluwaseyi
Adisa Oluwaseyi

Posted on

How to Lock a Resource group in Azure

Resource locks protect your Azure resources from accidental deletion or modification. With Resource lock you can manage locks at subscription, resource group, or individual resource levels within Azure portal.

In this guide we will be creating a resource group, add a lock to it and test deleting a resource in the resource group

Creating a Resource Group

Step 1:
Visit portal.azure.com, login or sign up if you don't have an account, you can get a free account at azure.microsoft.com/en-us/free/

Step 2:
On the Azure portal page click the search box and enter resource group, then click resource group

Image description

Step 3:
On the resource group page click create

Image description

Step 4:
Enter any name of your choice for your resource group, and select any region of your choice, then click review + create button

Image description

Step 5:
After validation has passed click create button

Image description

Step 6:
After the resource group has been created, click go to resource group

Image description

Adding a Delete Lock

Step 1:
On the resource group page click locks on the left side

Image description

Step 2:
On the locks page click add

Image description

Step 3:
Enter a lock name of your choice, lock type select delete, then add a note and click ok

Image description

Test deleting a resource in the resource group

Step 1:
Go to Azure portal page click the search box and enter storage account, then click storage account

Image description

Step 2:
On the storage account page click create button

Image description

Step 3:
Select the resource group we created earlier

Image description

Step 4:
Enter a storage account name of your choice, select any region of your choice leave other settings as default, then click review

Image description

Step 5:
After validation has passed click create button

Image description

Step 6:
After deployment is completed click Go to resource button

Image description

Step 7:
Click delete button

Image description

Step 8:
Viola!!! the resource can't be deleted

Image description

Top comments (1)

Collapse
 
yemmyoye profile image
Yemisi Oyesainu

good