How to find the disk type of the Azure Availability set using PowerShell?

There are two types of disks available in the Availability Set.

  • Aligned − for the managed disks.

  • Classic − for the unmanaged disks.

To get the disk types of the availability set, we first need to retrieve availability set information and then we need to retrieve the SKU property which stores the disk types

Before running this command make sure that you are connected to the Azure Cloud (if not use ConnectAzAccount) and proper azure subscription (Set-AzContext to set the Azure subscription)

To get the availability set information,

$availablityset = Get-AzAvailabilitySet -ResourceGroupName

if($availablityset.Sku -eq "Aligned"){"Managed disk"}
else{"Unmanaged disk"}