Maybe you want to review all your virtual machine disk types?
Using Azure Graph Explorer you can run the following query.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
$subscriptions = Get-AzSubscription | ForEach-Object { [PSCustomObject]@{ SubscriptionId = $_.Id SubscriptionName = $_.Name } } $VMs = Get-AzVM $VMs | ForEach-Object { $subscriptionName = ($subscriptions | Where-Object { $_.SubscriptionId -eq $_.Id.Split('/')[2] }).SubscriptionName [PSCustomObject]@{ VMName = $_.Name SubscriptionId = $_.Id.Split('/')[2] SubscriptionName = $subscriptionName ResourceGroup = $_.ResourceGroupName OSDisk = $_.StorageProfile.OsDisk.Name OSDiskSku = if ($_.StorageProfile.OsDisk.ManagedDisk.StorageAccountType) { $_.StorageProfile.OsDisk.ManagedDisk.StorageAccountType } else { "N/A" } DataDisks = ($_.StorageProfile.DataDisks | ForEach-Object { if ($_.ManagedDisk.StorageAccountType) { "$($_.Name) (SKU: $($_.ManagedDisk.StorageAccountType))" } else { "$($_.Name) (SKU: N/A)" } }) -join ", " } } | Export-Csv -Path "VMsDisksWithSubscriptionNameAndSku.csv" -NoTypeInformation |
You’ll get and output like this