question

JeevanReddyMandaliCW-4041 avatar image
0 Votes"
JeevanReddyMandaliCW-4041 asked ·

Help with Log Analytics Query

Hello people, Is there any Kusto query to get the OS disk type of all VMs, if it is a standard HDD or premium ? Please help.

azure-monitor
10 |1000 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.

1 Answer

tbgangav-MSFT avatar image
1 Vote"
tbgangav-MSFT answered ·

Hello @JeevanReddyMandaliCW-4041,

Thanks for reaching out! To get the OS disk type of all VMs (if it is a standard HDD or premium), I believe the better way is using Azure Resource Graph because it is the one that helps to explore all of your cloud resources and more effectively manage your cloud inventory. So I recommend to go to Resource Graph Explorer from your Azure Portal and run kusto query something like shown below.

 resources
 | where type == "microsoft.compute/virtualmachines"
 | extend OSDiskStorageAccountType = tostring(properties.['storageProfile'].osDisk.managedDisk.storageAccountType)

9806-arg2.png

Or you may even leverage Az PowerShell cmdlet Get-AzVM and get the OS disk type of all VMs (if it is a standard HDD or premium) by below command.

 (Get-AzVM).StorageProfile.OsDisk.ManagedDisk|Select StorageAccountType, Id

arg2.png (53.7 KiB)
·
10 |1000 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.