DEV Community

Afolabi Victor
Afolabi Victor

Posted on

HOW TO ADD LOCKS TO RESOURCE GROUP

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

Image description

HOW TO LOCK A RESOURCE GROUP

To do this
-we will create a resource group
-lock the resource group

HOW TO CREATE A RESOURCE GROUP

Go to azure account

Image description

search resource group

Image description

click on create

Image description

give the resource group a name
review and create

Image description

create

Image description

resource group is ready

Image description

Now the resource group is ready, lets proceed to lock it.

-open the resource group and click on lock

Image description

click "add"

Image description

give the lock a name

Image description

LOCK TYPES
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

FOR THIS TUTORIAL WE WILL USE THE DELETE LOCK TYPE

Image description

ADD A NOTE

CLICK "ok"

Image description

for this tutorial we will create a storage account and add to the resource group created, then we try to delete

if you dont know how to create a storage account

CLICK HERE

we created a storage account "testlockdelete2023"
Now lets try to delete

Image description

Image description

Image description

AS YOU CAN SEE THE LOCK PREVENTS THE CODE FROM DELETION

Top comments (0)