HOW TO ADD LOCKS TO RESOURCE GROUPS
Published: 2023-03-25 15:09:06


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

Resource locks protect your Azure resources from accidental deletion or modification. As an administrator, you can lock an Azure subscription, resource group, or resource to protect them from accidental user deletions and modifications. The lock overrides any user permissions. You can set locks that prevent either deletions or modifications. In the portal, these locks are called Delete and Read-only

**STEP 1**
Login your Microsoft Azure account

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

**STEP 2 **
search resource group


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

**STEP 3**
Click on Create

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

**STEP 4**
-Give the resource group a name [I used latemarchload]
-Click on Review and create

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

**STEP 5**
Click on create

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

**STEP 6**
-Click on the resource group
-Search for locks and click on it


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

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

**STEP 7**
-Click on '+ Add'
-Choose a lock name
-Choose lock type, I used **delete**
READ ONLY-means authorized users can read and modify a resource, but they can't delete it.

DELETE- means authorized users can read a resource, but they can't delete or update it
-Click ok


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

**STEP 8**
Now we would create a storage account using the locked resource group.
-Go home and search for storage account
-click on create


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

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

**STEP 9**
-Choose your subscription
-Choose the resource group we added a lock to earlier[latemarchload]
-Choose a unique name for the storage account
-Choose your region
-Click Review

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

**STEP 10**
Click on create

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

Click on Go to Resource

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

**STEP 11**
-Click on delete
-Type the name of the storage account[funbi]  to confirm deletion
-You'll see an error message popped up to confirm the efficiency of the Lock placed on the resource group

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


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

**STEP 12**
To remove the placed lock;
-Go to the resource group
-Search and click on locks

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

**STEP 13**
Click on delete


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

**STEP 14**
Go back to the resource group and try to delete the storage account after the deleting the lock

Storage account was deleted successfully because of the removal of the locks

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