How do I get the unattached disks and/or orphan disks in my environment using Azure Log Analytics

Copper Contributor

Hello All,

 

I've a doubt, is possible I use Azure Log Analytics to get informations about unattached and orphan disk in my subscription?

 

I now that I can achieve this using PowerShell, but if possible I like to use KQL. 

 

Tks

2 Replies
Hi,
You might have found a solution, but this is how I get mine (or a variation of this):

resources
| where type =~ 'Microsoft.Compute/disks'
| where managedBy == ''
| project name, resourceGroup, Sku=sku.tier, DiskState=properties.diskState, location


Cheers
J
Hi You can refer this one click powershell script that will fetch all the unattached azure disks in all your subscriptions

https://www.magicpowershell.com/2022/09/get-all-unattached-azure-disk.html