How to get the Azure VM storage account type using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To get the Azure VM storage account type using PowerShell, we need to get the Azure VM storage profile setting from the Get-AzVM command.

PS C:\> $vm = Get-AzVM -Name TestVM
PS C:\> $vm.StorageProfile.OsDisk.ManagedDisk.StorageAccountType

Output

To get the storage account type on the multiple VMs from the specific subscription, use the below command.

Get-AzVM | Select Name,ResourceGroupName,
@{N='StorageType';E={$_.StorageProfile.OsDisk.ManagedDisk.StorageAccountType}}
raja
Published on 31-Aug-2021 10:04:37
Advertisements