Exercise - Resource Lock
Create a resource
- Sign in to the Azure portal at https://portal.azure.com
- Select Create a resource.
- Under Categories, select Storage.
- Under Storage Account, select Create.
- On the Basics tab of the Create storage account blade, fill in the following information. Leave the defaults for everything else.
- Resource group: Create new > Name: demo-azure
- Storage account name: demoazurestorageaccount
- Location: default
- Performance: Standard
- Redundancy: Locally redundant storage (LRS)
- Select Review + Create to review your storage account settings and allow Azure to validate the configuration.
- Once validated, select Create. Wait for the notification that the account was successfully created.
- Select Go to resource.
Apply a read-only resource lock
- Scroll down until you find the Settings section of the blade on the left of the screen.
- Select Locks.
- Select + Add.
- Enter a Lock name: sa-readlock
- Verify the Lock type is set to Read-only.
- Select OK.
Add a container to the storage account
- Scroll up until you find the Data storage section of the blade on the left of the screen.
- Select Containers.
- Select + Container.
- Enter a container name and select Create.
- You should receive an error message: Failed to create storage container.
Modify the resource lock
- Scroll down until you find the Settings section of the blade on the left of the screen.
- Select Locks.
- Select the read-only resource lock you created.
- Change the Lock type to Delete and select OK.
Create a storage container
- Scroll up until you find the Data storage section of the blade on the left of the screen.
- Select Containers.
- Select + Container.
- Enter a container name and select Create.
- Your storage container should appear in your list of containers.
Delete the storage account
- Scroll up until you find Overview at the top of the blade on the left of the screen.
- Select Overview.
- Select Delete.
- You should get a notification letting you know you can't delete the resource because it has a delete lock. In order to delete the storage account, you'll need to remove the delete lock.
Remove the delete lock
- Select your storage account name in the breadcrumb at the top of the screen.
- Scroll down until you find the Settings section of the blade on the left of the screen.
- Select Locks.
- Select Delete.
Delete the storage account
- Select Home in the breadcrumb at the top of the screen.
- Select Storage accounts
- Select the storage account you used for this exercise.
- Select Delete.