Create a Resource Group
$splat = @{
Name = 'availabilitySet-rg'
Location = 'CentralUS'
}
New-AzResourceGroup @splat
Create a Managed Availability Set
$splat = @{
Location = "CentralUS"
Name = "availabilitySetPractice"
ResourceGroupName = "availabilitySet-rg"
Sku = "aligned"
PlatformFaultDomainCount = 2
PlatformUpdateDomainCount = 2
}
New-AzAvailabilitySet @splat
Important notes:
- SKU aligned means it uses managed disk.
- Fault Domain max is 3 (currently & depends on region)
- Update Domain max is 20 (currently)
- Availability sets are under a 99.95% Azure SLA.
Create Virtual Machines in an Availability Set
$cred = Get-Credential
1..2 | ForEach-Object -Parallel {
New-AzVm `
-ResourceGroupName "availabilitySet-rg" `
-Name "myVM$_" `
-Location "CentralUS" `
-VirtualNetworkName "vNet" `
-SubnetName "Subnet" `
-SecurityGroupName "NSG" `
-PublicIpAddressName "publicIpAddress$_" `
-AvailabilitySetName "availabilitySetPractice" `
-Credential $using:cred `
}
Delete Resources Clean-up
Remove-AzResourceGroup -Name 'availabilitySet-rg'
Sources
Tutorial: Create and deploy highly available virtual machines with Azure PowerShell
Manage the availability of Windows virtual machines in Azure
Top comments (0)