Nov 05 2020
02:50 PM
- last edited on
Apr 08 2022
10:40 AM
by
TechCommunityAP
Nov 05 2020
02:50 PM
- last edited on
Apr 08 2022
10:40 AM
by
TechCommunityAP
hi!
I have a process that adds some tags to VMs in Azure. I would love to query log analytics for these tags.
Here is an example of the tags:
I found this query to parse VMInsights tags but am not sure where to go to look up these tags.
InsightsMetrics
| extend Tags = parse_json(Tags)
| where Tags.["AutomanagedPC"] has "true"
Any tips would be greatly appreciated :)
Nov 06 2020 10:31 AM
InsightMetrics tags are not the ones you are looking for. But why are you using Log Analytics? This type of queries should be targeted at Azure Resource Graph instead.
Read the following article: https://docs.microsoft.com/en-us/azure/governance/resource-graph/first-query-portal
And use this ARG query:
resources
| where type =~ 'Microsoft.Compute/virtualMachines'
| where tags.AutomanagedPC == 'true'
You can also use ARG via Az PowerShell or CLI: https://docs.microsoft.com/en-us/azure/governance/resource-graph/overview#running-your-first-query
May 25 2022 12:41 PM