3.2.5 Configure a Resource Lock

How to configure a resource lock.

Task 1: Create a Resource

  1. Sign into Azure.

  2. Select "Create a Resource".

  3. Under "Categories", choose "Storage".

  4. Under "Storage Account", choose "Create".

  5. On the "Basics" tab of the "Create storage account" blade, fill in the provided info.

  6. Choose "Review + Create" and allow Azure to validate the configuration. Now choose "Go to resource".

Task 2: Apply a ReadOnly Resource Lock

  1. Select the "Settings" section of the left-hand blade.

  2. Select "Locks".

  3. Select "Add".

  4. Name your lock, verify it is set to ReadOnly and then select "Ok".

Task 3: Add a Container

  1. Under the "Data Storage" section of the blade, select "Containers".

  2. Select "+ Container" and enter a container name.

  3. Upon selecting "Create", you should get an error message; "Failed to create storage container".

Task 4: Modify the Resource Lock and Add a Container

  1. Go back to the resource lock we created and change the type to "Delete".

  2. Go back to "Data Storage" and follow the Task 3 steps again.

  3. This should now create successfully.

Task 5: Delete the Storage Account

  1. Select "Overview" from the blade.

  2. Choose "Delete".

  3. You should be notified that you cannot delete the container due to a lock.

Task 6: Remove the Resource Lock and Delete the Account

  1. Go back to the resource lock we created and choose "Delete".

  2. Go back to the storage account we created and choose "Delete".

  3. To prevent accidental deletion, you should be prompted to enter the name of the storage account you wish to delete.

  4. Once you enter the name, the account should be deleted.