Q. How can I check using PowerShell if an Azure region supports 2 or 3 fault domains when using managed disks?
A. Normally with Azure Resource Manager an Availability Set using three fault domains however when the Availability Set is aligned with managed disks in some regions the maximum number of fault domains is two. The big difference when using managed disks is that each fault domain also aligns to a different storage cluster for the storage of the VMs on that fault domain. This ensures a storage failure could not impact more than one fault domain of virtual machines.
The numbers of supported fault domains per availability set with managed disks are published at https://docs.microsoft.com/en-us/azure/virtual-machines/windows/manage-availability however these is no simple way to check this using PowerShell. The best options is to try to create with 3 and if it fails then create with 2. For example:
$ASName = "TestAS"
$Location = "WestUS2"
$ResourceGroupName = "RG-SCUSA"
Write-Host "Trying to create with three fault domains"
New-AzureRmAvailabilitySet -Location $Location -Name $ASName -ResourceGroupName $ResourceGroupName -PlatformFaultDomainCount 3 `
-PlatformUpdateDomainCount 5 -Sku Aligned -EA SilentlyContinue
if ($error.Count -gt 0)
Write-Host "Failed to create with three, creating with two fault domains"
New-AzureRmAvailabilitySet -Location $Location -Name $ASName -ResourceGroupName $ResourceGroupName `
-PlatformFaultDomainCount 2 -PlatformUpdateDomainCount 5 -Sku Aligned
Remove-AzureRmAvailabilitySet -Name $ASName -ResourceGroupName $ResourceGroupName -Force