DEV Community

Cover image for Update and Maintain Resources in Azure - Manage tags and locks
nnamdi nmarah
nnamdi nmarah

Posted on

Update and Maintain Resources in Azure - Manage tags and locks

If you’ve worked through the earlier exercises, you’ve already added a subnet to a virtual network, modified a virtual machine, and interacted with an Azure storage account. This final part of the guided project focuses on using tags and resource locks to better organize, monitor, and protect your environment. In this exercise, you’ll revisit those resources and apply tags, locks, or both where appropriate.

Scenario

The Azure administrator wants to finalize a few configurations to improve visibility and safeguard resources. Specifically, they want to ensure the virtual machine running as an FTP server isn’t accidentally deleted, and they’d like a simple way to identify which department owns each resource and its purpose.

Managing tags and locks on virtual machines

Tags provide a convenient way to organize and categorize resources. They can be applied at different levels, making it easier to group resources in a way that fits your environment.

Adding tags to a virtual machine

Start by assigning two tags to the virtual machine—one to describe its purpose and another to indicate the department it supports.

  • In the Azure portal, search for Virtual machines under Services.
  • Select the guided-project-vm virtual machine.

virtual machine

  • From the menu pane, select Tags.
  • On one line for Name, enter Department, and for Value, enter Customer Service
  • On the next line, for Name, enter Purpose, and for Value, enter FTP Server.
  • Select Apply.

Tags

Add a resource lock to a VM

  • While on the Virtual Machine page, expand the Settings submenu and select Locks.

Resource lock

  • Select + Add.

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.

VM-delete-lock

That’s it—your virtual machine is now protected against accidental deletion and includes tags for easier tracking and organization. Next, let’s move on to the networking side.

Adding tags to network resources

  • Head over to the Virtual Networks page and select the guided-project-vnet network to begin applying tags.

virtual networks

  • From the menu pane, select Tags.

From the menu select Tags

Note: You’ll notice you can either choose from existing tags or create new ones. You can also pick a tag name or value and define the other field yourself.

  • Set Name to Department.
  • Enter IT as the value.
  • Click Apply.

click apply

Now both the VNet and VM are organized.

Conclusion

Effectively managing metadata and protection features in the Microsoft Azure Portal is essential for keeping cloud resources organized and secure. Tags—structured as key-value pairs—can be applied to resources like virtual machines and networking components to enhance organization, cost management, automation, and governance. By tagging resources such as virtual networks, subnets, and network security groups, administrators can group them by environment, department, owner, or project, making it easier to filter assets, track costs, and apply policies consistently.

Alongside tagging, resource locks add an extra layer of security for critical resources. These locks help prevent accidental deletion or unwanted changes by enforcing either Delete or Read-only restrictions. When used together, tags improve visibility and resource management, while locks strengthen protection—ensuring a more structured, secure, and well-controlled Azure environment.

Top comments (0)