DEV Community

Cover image for Organising and Protecting Azure Resources: A Guide to Tags and Locks
Louis Oodo
Louis Oodo

Posted on

Organising and Protecting Azure Resources: A Guide to Tags and Locks

Organizing and Protecting Azure Resources: A Guide to Tags and Locks

Introduction

As your cloud environment grows, keeping track of your resources and preventing accidental data loss becomes a top priority. Azure provides two simple yet powerful tools for this: Tags and Resource Locks. Tags allow you to categorize resources for better billing and organization, while Locks provide a safety net against accidental deletion. In this guide, we will walk through applying these management features to a Virtual Machine and a Virtual Network.


Add Tags and a Resource Lock to a VM

  1. Login to Microsoft Azure at https://portal.azure.com.
  2. From the Azure portal home page, in the search box, enter virtual machines.
  3. Select virtual machines under services.
    virtual machines

  4. Select the guided-project-vm virtual machine.
    guided-project-vm

  5. From the menu pane, select Tags.

  6. On one line for Name enter Department and for Value enter Customer Service.

  7. On the next line, for Name enter Purpose and for Value enter FTP Server.

  8. Select Apply.
    Tags

Add a Resource Lock to a VM

While you’re working on the virtual machine, it’s a great time to add a resource lock to ensure it isn't accidentally removed.

  1. If necessary, expand the Settings submenu.
  2. Select Locks.
  3. Select + Add.
    Settings

  4. For the name, enter VM-delete-lock.

  5. For the Lock type, select Delete.

  6. You may enter a note to help remind you why you created the lock.

  7. Select OK.
    VM-delete-lock

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

  1. Select Home to return to the Azure portal home page. Home

Add Tags to Network Resources

  1. From the Azure portal home page, in the search box, enter virtual networks.
  2. Select virtual networks under services.
    virtual networks

  3. Select the guided-project-vnet network.
    guided-project-vnet

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

  5. For the Name select Department.

  6. For the Value enter IT.

  7. Select Apply.
    Tags


Conclusion

Now both the VNet and VM are organized and secured. By implementing a consistent tagging strategy, you make it much easier to filter resources and analyze your Azure bill by department or project. Furthermore, by applying a "Delete" lock, you've added a critical layer of protection for your infrastructure. These small administrative steps go a long way in maintaining a professional and reliable cloud environment.

I would love to hear from you

Top comments (0)