The goal of this task is to verify the function of ARM resource locks. This includes creating resource level and resource group level locks and verify that they prevent unwanted changes to resources.

Lock a resource

When you will login to your azure portal with the generated credentials. You will see that there are some resources pre created for you.

This all you will need to work with this lab.

Here in the resource group you can see that, there are 3 resoruces. Go to the route table resource.

Go to the locks option for the route table, click on + Add to add a lock.

Name this lock as readonly-rt and set the lock type as Read-only. Click on OK to add the lock.

Now go to the configuration of route table. Change the Propagate gateway routes option to yes and click on Save.

You will see an error that, we can't modify the config as there is a read-only lock on this route table.

Lock a resource group

Go back to your resource group and open the Locks. Here click on + Add to add a new lock. You can also see the lock for route table here.

Name this lock as delete-rg and set the lock type as Delete. Click on OK to add the lock.

Now go to the lock-nsg resource of your resource group. Try to delete the nsg as highlighted below.

You will again encounter an error, that we can't delete a resource in this resource group, because of the delete lock.

Cleanup

Now go back to the locks in the resource group. Click on the delete option in front of the locks to delete them.

Now try to delete all the resource by selecting them all and clicking on the delete button as highlighted below.

Enter yes in the confirmation and click on Delete.

You can see that all the resource are now deleted, after we removed the locks. There are 0 resources now.

Our lab is now complete.