How to get the update domain count of the Azure Availability set using PowerShell?

Virtual machines inside the Availability set get the update automatically, they reboot together and they are used for the patching of the virtual machines.

To get the update domain count from the availability set, we can use the below command.

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,

$availablityset = Get-AzAvailabilitySet -ResourceGroupName
Resourcegroupname -Name AvailabilitySetName

To get the update domain count,