Help with Log Analytics Query

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

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.
1,802 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2020-06-11T11:05:36.203+00:00
    KrishnaG-MSFT 7,971 Reputation points Microsoft Employee

    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  
    
    No comments