** Introduction**
Having completed the previous exercises, you’ve managed to add a subnet to a virtual network, made changes to a virtual machine, and worked with an Azure storage account.
As your Azure environment grows, keeping resources organized and protected becomes essential. Tags help you track metadata such as cost centers, owners, and environments—while locks ensure that important resources cannot be accidentally deleted or modified.
In this post, you’ll learn how to apply tags, manage resource locks, and strengthen governance across your Azure resources, building on the work you completed in the previous exercises.
** Step-by-Step Guide**
** Add a Tag to a Resource**
- Log in to Azure Portal: https://portal.azure.com
- Select virtual machines under services.
- Select guided-project-vm virtual machine
- From the left menu, select Tags.
- Click + Add.
- Add the following tag:
On one line * Name: Department
* Value: Customer Service
On the next line
* Name: Purpose
* Value: FTP Server
- Select Save. Select Apply
Your resource now has metadata attached for easier tracking and reporting.
** Create a Resource Lock**
Locks prevent accidental deletion or changes to a resource, so While you’re working on the virtual machine, it’s a great time to add a resource lock..
- expand the Settings submenu.
- Select Locks
- Select + Add.
- For the name, enter VM-delete-lock.
- For the Lock type, select Delete. You may enter a note to help remind you why you created the lock.
- Select OK.
Now, your storage account cannot be deleted until the lock is removed.
** Test the Lock**
You can go ahead to test the lock by:
- Open the storage account.
- Select Delete.
- You’ll receive an error because the resource is locked.
- Cancel the operation — the lock works as expected.
That’s it. Now the VM is protected from deletion and has tags assigned to help track use. Time to move onto the network.
Add tags to network resources
- Select Home to return to the Azure portal home page.
- From the Azure portal home page, in the search box, enter virtual networks.
- Select virtual networks under services.
- Select the guided-project-vnet network.
- From the menu pane, select Tags.
Note: Notice that now you can select an existing tag to apply or add a new tag. You can also select just the name or value and apply create something new in the other field.
- For the Name select Department.
- For the Value enter IT.
- Select Apply.
Now both the VNet and VM have are organized.
** Conclusion**
Great work! You’ve now improved governance in your Azure environment by using tags for organization and locks for protection. These small steps make resource management more scalable and secure—especially in environments with multiple admins or large deployments.
Next, we move to the final step of this series:
Cleaning Up Azure Resources Safely and Efficiently.




Top comments (0)