Sep 07 2021 11:59 PM
In azure cloud 3 instances like VM's, these 3 VM's should be deployed in 3 diff virtual networks and under 3 availability zones, so we achieve High Availability,in case one of the availability zone goes offline (down) my app still run through other availability zone, all 3 availability zones are under single region say East US so how will you write power shell for this or how will you automate this infrastructure provisioning on azure cloud?
Oct 28 2021 04:16 AM
@Prasad_Raju in the New-AZVMConfig and New-AZVM PowerShell cmdlets there is a parameter -Zone for specifying the Availability Zone. So essentially you would have three lines of powershell similar to this:
$vmConfig = New-AzVMConfig -VMName myVM1 -VMSize Standard_DS1_v2 -Zone 1
...
$vmConfig = New-AzVMConfig -VMName myVM2 -VMSize Standard_DS1_v2 -Zone 2
...
$vmConfig = New-AzVMConfig -VMName myVM3 -VMSize Standard_DS1_v2 -Zone 3
...
There's some good documentation here:
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/create-powershell-availability-zone