SOLVED

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

%3CLINGO-SUB%20id%3D%22lingo-sub-110564%22%20slang%3D%22en-US%22%3EWhat%20is%20the%20query%20to%20get%20the%20information%20about%20tagged%20Virtual%20machines%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-110564%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBasically%20I%20want%20to%20generate%20the%20report%20for%20all%20the%20tagged%20Virtual%20machine%20from%20Log%20analytics.%20I%20need%20to%20know%20which%20VMs%20are%20tagged%20and%20which%20are%20not.%20Could%20you%20please%20help%20me%20out%20to%20create%20the%20query%20in%20l%3Bog%20analytics%20please.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESachin%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-110564%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-134536%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20query%20to%20get%20the%20information%20about%20tagged%20Virtual%20machines%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-134536%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Piyush%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENot%20at%20the%20moment%20as%20I%20am%20trying%20to%20create%20the%20Run%20Book%20for%20the%20same.%20I%20will%20update%20you%20once%20that%20is%20ready.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESachin%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-112604%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20query%20to%20get%20the%20information%20about%20tagged%20Virtual%20machines%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-112604%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Sachin%3C%2FP%3E%3CP%3EDid%20you%20manage%20to%20write%20something%20for%20your%20use%20case.%20If%20yes%2C%20would%20you%20be%20able%20to%20share%20details%20as%20I%20need%20almost%20the%20same%20thing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3EPiyush%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-111070%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20query%20to%20get%20the%20information%20about%20tagged%20Virtual%20machines%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-111070%22%20slang%3D%22en-US%22%3EThanks%20Stanislav%20.%20Will%20try%20that%20option.%3CBR%20%2F%3E%3CBR%20%2F%3EAppreciate%20your%20help%20!!!!!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-111018%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20query%20to%20get%20the%20information%20about%20tagged%20Virtual%20machines%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-111018%22%20slang%3D%22en-US%22%3EThere%20isn't%20a%20log%20out%20of%20the%20box%20that%20has%20information%20on%20tags%20for%20Virtual%20machines.%20I%20would%20suggest%20to%20develop%20something%20on%20your.%20Create%20a%20workflow%20that%20daily%20goes%20trough%20all%20your%20VMs%20in%20all%20Azure%20subscription%20and%20stores%20which%20VMs%20are%20tagged%20and%20which%20are%20not%20in%20your%20Log%20Analytics%20workspace.%20That%20workflow%20can%20be%20a%20runbook%2C%20logic%20app%20or%20azure%20functions.%20Whatever%20service%20is%20best%20for%20you%20to%20develop%20on.%20Once%20you%20have%20the%20log%20in%20Log%20Analytics%20you%20can%20use%20the%20query%20language%20to%20find%20the%20information%20you%20need.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-110863%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20query%20to%20get%20the%20information%20about%20tagged%20Virtual%20machines%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-110863%22%20slang%3D%22en-US%22%3E%3CP%3EAny%20help%20would%20be%20appreciated..%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1497684%22%20slang%3D%22en-US%22%3ERe%3A%20What%20is%20the%20query%20to%20get%20the%20information%20about%20tagged%20Virtual%20machines%20%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1497684%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9172%22%20target%3D%22_blank%22%3E%40Stanislav%20Zhelyazkov%3C%2FA%3E%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F81561%22%20target%3D%22_blank%22%3E%40Sachin%20Gupta%3C%2FA%3E%26nbsp%3Bor%20we%20can%20use%20the%20Azure%20Resource%20Graph%20Explorer%20to%20get%20the%20tag%20values.%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3Eresources%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BTags%26nbsp%3B%3D%26nbsp%3Btags.%3CTAG%3E%26nbsp%3B(%26nbsp%3Bif%26nbsp%3Byou%26nbsp%3Bwish%26nbsp%3Bto%26nbsp%3Bextract%26nbsp%3Bthe%26nbsp%3Bvalues%26nbsp%3Bfor%26nbsp%3Ba%26nbsp%3Bparticular%26nbsp%3Btag%26nbsp%3Bname)%3C%2FTAG%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eproject%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bname%2C%26nbsp%3Btype%2C%26nbsp%3BTags%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3EIf%26nbsp%3Byou%26nbsp%3Bwish%26nbsp%3Bto%26nbsp%3Bget%26nbsp%3Ball%26nbsp%3Btags%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3Eresources%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bname%2C%26nbsp%3Btype%2C%26nbsp%3Btags%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

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

6 Replies
Highlighted

Any help would be appreciated..

Highlighted
Solution
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.
Highlighted
Thanks Stanislav . Will try that option.

Appreciate your help !!!!!
Highlighted

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

Highlighted

Hello Piyush,

 

Not at the moment as I am trying to create the Run Book for the same. I will update you once that is ready.

 

Regards,

 

Sachin

Highlighted

@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