DEV Community

Cover image for Update and Maintain Resources in Azure - Manage tags and locks
Fredrick Chukwuma
Fredrick Chukwuma

Posted on

Update and Maintain Resources in Azure - Manage tags and locks

If you’ve 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. The final set of tasks for this guided project focus around working with tags and resource locks to help manage and monitor your environment. During this exercise, you’ll go back into each of the areas you’ve already worked to add tags, locks, or a combination of both.

Scenario

The Azure admin hopes that you can wrap a few things up to help with monitoring and protecting resources. They want to know that someone can’t accidentally get rid of the virtual machine that’s running as an FTP server, and they want a quick way to see which department is using resources and the resource’s purpose.

Manage tags and locks on VMs

Adding tags to resources is a quick way to be able to group and organize resources. Tags can be added at different levels, giving you the ability to organize and group resources at a level that makes sense for you.

Add tags to a virtual machine
You’ll start by adding a pair of tags to the virtual machine. One tag will be to identify the purpose of the virtual machine and the other will be to indicate the department the machine supports.

  • from the Azure portal, search for and select virtual machines under services.
  • Select the guided-project-vm virtual machine.

select vm

  • 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.

tag apply

Add a resource lock to a VM

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

locks

  • Select + Add.

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.

lock set

That’s it. Now the VM is protected from deletion and has tags assigned to help track use. Time to move on to the network.

Add tags to network resources

  • From the Virtual Networks page, select the guided-project-vnet network.

vnet

  • From the menu pane, select Tags.

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 create something new in the other field.

  • For the Name, select Department.
  • For the Value, enter IT.
  • Select Apply.

tag

Now both the VNet and VM are organized.

Conclusion
Managing metadata and protection mechanisms in the Microsoft Azure Portal is an important part of maintaining cloud resources efficiently. Tags are key-value pairs applied to resources such as virtual machines and network components to improve organization, cost tracking, automation, and governance. By tagging Virtual Machines (VMs) and network resources such as virtual networks, subnets, and network security groups, administrators can categorize resources by environment, department, owner, or project. This makes it easier to filter resources, generate cost reports, and enforce operational policies across the environment.
In addition to tagging, resource locks provide a protection layer for critical virtual machines. Locks can prevent accidental deletion or modification of important resources by applying either Delete or Read-only restrictions. When properly used together, tags improve visibility and management while locks enhance resource protection, helping administrators maintain a well-organized, secure, and controlled Azure environment.

Top comments (0)