How to Lock a Resource group in Azure
Tags: cloud, azure, devops, cloudcomputing
Published: 2023-05-23 17:19:27

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](url), login or sign up if you don't have an account, you can get a free account at [azure.microsoft.com/en-us/free/](url)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/chk41grcv5jccqyx0fib.png)

**Step 3:**
On the resource group page **click create**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jv2nlg6gh4gccle0tid6.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qnwvzksouep43uhlx5w3.png)

**Step 5:**
After validation has passed **click create button**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dfkxt63q8wt7fhzb5wrx.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dzuny52od2f8qjigwbud.png)

**_Adding a Delete Lock_**

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7pds1xd1luawmsjmnply.png)

**Step 2:**
On the locks page **click add**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2cx9kyspqljugzvk20ff.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b22g8mv8ecxlczty1lhs.png)

**_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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/puz985wcirclp0kmfwjn.png)

**Step 2:**
On the storage account page **click create button**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ho6t0odf4le8t64t6o1c.png)

**Step 3:**
**Select the resource group** we created earlier

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2t8gcqytn3enq2v4dtfs.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8deme1fcjvizr304v257.png)

**Step 5:**
After validation has passed **click create button**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/25hlje1n82txqe39k272.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fk7h4upzilfvw5wknz0j.png)

**Step 7:**
**Click delete button**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7avxe4xttlv0zo4f0obp.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wowxl1j7td2fh1nvidx2.png)