Search code examples
azurepowershellazure-storage

Get storage type if disk of vm is premium or standard using get-azurermvm


I'm an IT pro and writing a script which gives the output of vm name, vm size, and the data disk size which is attached.

Below is the command which I'm using for unmanaged and managed disk vm both. I wanted to know if i can use the get-azurermvm somehow to get the details of the disk type which is attached if it is SSD or HDD?

    $allvm = Get-Azurermvm | ForEach-Object { 
 $props = [ordered]@{
                    "Name" = $_.name
                    "Disk Size" = $_.StorageProfile.DataDisks.disksizegb
                    "VM Size" = $_.HardwareProfile.VmSize
                    }
                $Result += @(New-Object pscustomobject -Property $props)
}

Write-Output $Result

Solution

  • Got this script to achieve the same

    https://gallery.technet.microsoft.com/Azure-ARM-VM-Inventory-57ba01b7