Azure Script to find IAAS disk configurations

ACDBA 416 Reputation points
2022-12-20T21:39:39.127+00:00

Hi All,

I am trying to use below PS script to find out azure IAAS disk configuration including (LUN,Data Caching,IO,Bandwidth).

Connect-AzAccount  
  
Set-AzContext -Subscription 'SubName'  
  
$vm=Get-AzVM -ResourceGroupName ReGrpNAME -Name VMNAME  
  
$disks = $vm.StorageProfile.DataDisks  
  
foreach ($disk in $disks) {  
    $lun = $disk.Lun  
     $size = $disk.DiskSizeGB  
    $maxIops = $disk.IopsReadWrite  
    $maxThroughput = $disk.ThroughputReadWriteMBps  
    $hostCaching = $disk.Caching  
     Write-Output "LUN: $lun, Drive letter: $driveLetter, Storage type: $storageType, Size: $size GB, Max IOPS: $maxIops, Max throughput: $maxThroughput MB/s, Host caching: $hostCaching"  
}  
  

Unfortunately its not providing me with IOPS and Throughput. Any idea why is it so? LUN and drive letter are present in output.

Also do we have any scripts which can provide the same information just by giving vm name as parameter instead of passing subscription name and resource group name?

Thanks,
ACDBA

SQL Server on Azure Virtual Machines
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,987 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Luke Murray 11,091 Reputation points MVP
    2022-12-20T22:06:31.867+00:00

    Hi, checkout the Get-PspAzManagedDiskInfo.ps1 - script found here: https://github.com/powershellpr0mpt/PSP-AzureInventory/blob/861aa2acd0e6108001330a646229f59a1043d0a4/PSP-AzureInventory/public/Get-PspAzManagedDiskInfo.ps1#L117

    Its part of the PSP-AzureInventory module, which might be what you need: https://github.com/powershellpr0mpt/PSP-AzureInventory/tree/861aa2acd0e6108001330a646229f59a1043d0a4

    By default, its grabbing all the disks, if you want to target specific disks - then you will need to enter the RG name etc.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.