Forum Discussion

Sachin Gupta's avatar
Sachin Gupta
Copper Contributor
Sep 26, 2017
Solved

What is the query to get the information about tagged Virtual machines ?

Hello,

 

Basically I want to generate the report for all the tagged Virtual machine from Log analytics. I need to know which VMs are tagged and which are not. Could you please help me out to create the query in l;og analytics please.

 

Thanks,

 

Sachin

  • There isn't a log out of the box that has information on tags for Virtual machines. I would suggest to develop something on your. Create a workflow that daily goes trough all your VMs in all Azure subscription and stores which VMs are tagged and which are not in your Log Analytics workspace. That workflow can be a runbook, logic app or azure functions. Whatever service is best for you to develop on. Once you have the log in Log Analytics you can use the query language to find the information you need.

7 Replies

  • There isn't a log out of the box that has information on tags for Virtual machines. I would suggest to develop something on your. Create a workflow that daily goes trough all your VMs in all Azure subscription and stores which VMs are tagged and which are not in your Log Analytics workspace. That workflow can be a runbook, logic app or azure functions. Whatever service is best for you to develop on. Once you have the log in Log Analytics you can use the query language to find the information you need.
    • Arien_deGroot's avatar
      Arien_deGroot
      Copper Contributor
      https://cloudbunnies.wordpress.com/2020/09/10/azuremonitor-how-to-use-resource-tags-for-filtering-queries-in-workbooks/
    • gayatri1940's avatar
      gayatri1940
      Copper Contributor

      Stanislav_Zhelyazkov Sachin Gupta or we can use the Azure Resource Graph Explorer to get the tag values.

      resources
      extend Tags = tags.<tag name> ( if you wish to extract the values for a particular tag name)
      project name, type, Tags

      If you wish to get all tags
      resources
      summarize by name, type, tags

       

    • Sachin Gupta's avatar
      Sachin Gupta
      Copper Contributor
      Thanks Stanislav . Will try that option.

      Appreciate your help !!!!!
      • Piyush Gupta's avatar
        Piyush Gupta
        Copper Contributor

        Hi Sachin

        Did you manage to write something for your use case. If yes, would you be able to share details as I need almost the same thing.

         

        Regards

        Piyush

Resources