Help with Log Analytics Query

Jeevan Reddy Mandali (CW) 1 Reputation point
2020-06-11T04:37:44.28+00:00

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
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,803 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,381 Reputation points
    2020-06-11T11:05:36.203+00:00

    Hello @Jeevan Reddy Mandali (CW) ,

    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  
    
    1 person found this answer helpful.
    0 comments No comments