question

DarrinMiskiewicz-8880 avatar image
0 Votes"
DarrinMiskiewicz-8880 asked

Using KQL to find duplicate VM names in Azure

I have a need to use a KQL query to find duplicate Azure VM names. My query is below and I am struggling to find a way to return only the duplicate values with the associated RG and Sub name. Is this possible in KQL?

 resources
 | where type == "microsoft.compute/virtualmachines" 
 | join kind=inner (
     ResourceContainers
     | where type =~ 'microsoft.resources/subscriptions'
     | project SubName=name, subscriptionId)
 on subscriptionId    
 | project name, resourceGroup, subscriptionId, SubName
 | summarize by name,SubName,resourceGroup
microsoft-graph-query-parameters
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers