Create virtual machines in an availability zone using the Azure portal
Applies to: ✔️ Linux VMs ✔️ Windows VMs
This article steps through using the Azure portal to create highly resilient virtual machines in availability zones. Azure availability zones are physically separate locations within each Azure region that are tolerant to local failures. Use availability zones to protect your applications and data against unlikely datacenter failures.
Click Create a resource > Compute > Virtual machine.
In the Virtual machines page, select Create and then Virtual machine. The Create a virtual machine page opens.
In the Basics tab, under Project details, make sure the correct subscription is selected and then choose a resource group or create a new one.
Under Instance details, type a name for the Virtual machine name.
For Availability options, leave the default of Availability zone.
For Availability zone, the drop-down defaults to Zone 1. If you choose multiple zones, a new VM will be created in each zone. For example, if you select all three zones, then three VMs will be created. The VM names are the original name you entered, with -1, -2, and -3 appended to the name based on number of zones selected. If you want, you can edit each of the default VM names.
Complete the rest of the page as usual. If you want to create a load balancer, go to the Networking tab > Load Balancing > Load balancing options. You can choose either an Azure load balancer or an Application gateway.
For a Azure load balancer:
You can select an existing load balancer or select Create a load balancer.
To create a new load balancer, for Load balancer name type a load balancer name.
Select the Type of load balancer, either Public or Internal.
Select the Protocol, either TCP or UDP.
You can leave the default Port and Backend port, or change them if needed. The backend port you select will be opened up on the Network Security Group (NSG) of the VM.
When you are done, select Create.
For an Application Gateway:
Select either an existing application gateway or Create an application gateway.
To create a new gateway, type the name for the application gateway. The Application Gateway can load balance multiple applications. Consider naming the Application Gateway according to the workloads you wish to load balance, rather than specific to the virtual machine name.
In Routing rule, type a rule name. The rule name should describe the workload you are load balancing.
For HTTP load balancing, you can leave the defaults and then select Create. For HTTPS load balancing, you have two options:
Upload a certificate and add the password (application gateway will manage certificate storage). For certificate name, type a friendly name for the certificate.
Use a key vault (application gateway will pull a defined certificate from a defined key vault). Select your Managed identity, Key Vault, and Certificate.
After the VMs and application gateway are deployed, log in to the VMs to ensure that either the application gateway certificate is uploaded onto the VMs or the domain name of the VM certificate matches with the domain name of the application gateway.