Forum Topic

Thanks for your participation and contribution.

Back to Log Analytics

Azure Graph Queries Collection


Source :

Find Orphaned Disks

| where type has "microsoft.compute/disks"
| extend diskState = tostring(properties.diskState)
| where managedBy == ""
or diskState == 'Unattached'
| project id, diskState, resourceGroup, location, subscriptionId , sku.tier , properties.diskSizeGB

Find Orphaned NICs

| where type has ""
| where "{nicWithPrivateEndpoints}" !has id
| where properties !has 'virtualmachine'
| project id, resourceGroup, location, subscriptionId


This query isn’t technically an orphaned resource, however if you make an NSG you typically want it applied to a NIC or subnet. This query looks through the Network/networksecuritygroups resource type and looks for null network interfaces and subnets under the properties.

| where type =~ '' and isnull(properties.networkInterfaces) and isnull(properties.subnets)
| project Resource=id, resourceGroup, subscriptionId, location

Last updated

1-1 of 1

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.