| title | Tutorial: Prerequisites for a single-subnet availability group |
|---|---|
| description | This tutorial shows how to configure the prerequisites for creating a SQL Server Always On availability group on Azure Virtual Machines in a single subnet. |
| author | tarynpratt |
| ms.author | tarynpratt |
| ms.reviewer | mathoma |
| ms.date | 11/18/2022 |
| ms.service | virtual-machines-sql |
| ms.subservice | hadr |
| ms.topic | how-to |
| ms.custom | seo-lt-2019 |
| editor | monicar |
| tags | azure-service-management |
[!INCLUDEappliesto-sqlvm]
Tip
Eliminate the need for an Azure Load Balancer or distributed network name (DNN) for your Always On availability group by creating your SQL Server VMs in multiple subnets within the same Azure virtual network.
This tutorial shows how to complete the prerequisites for creating a SQL Server Always On availability group on Azure Virtual Machines (VMs) within a single subnet. When you've completed the prerequisites, you'll have a domain controller, two SQL Server VMs, and a witness server in a single resource group.
While this article manually configures the availability group environment, it's also possible to do so using the Azure portal, PowerShell or the Azure CLI, or Azure Quickstart Templates as well.
Time estimate: It might take a couple of hours to complete the prerequisites. Much of this time is spent creating virtual machines.
The following diagram illustrates what you build in the tutorial.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/00-end-state-sample-no-elb.png" alt-text="Diagram of the set up of an Availability group.":::
Note
It's now possible to lift and shift your availability group solution to SQL Server on Azure VMs using Azure Migrate. See Migrate availability group to learn more.
This tutorial assumes that you have a basic understanding of SQL Server Always On availability groups. If you're not familiar with this technology, see Overview of Always On availability groups (SQL Server).
You need an Azure account. You can open a free Azure account or activate Visual Studio subscriber benefits.
To create the resource group in the Azure portal, follow these steps:
-
Sign in to the Azure portal.
-
Select + Create a resource to create a new resource in the portal.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-multi-subnet/01-portal-plus.png" alt-text="Screenshot the Azure portal, with +Create a resource highlighted.":::
-
Search for resource group in the Marketplace search box and choose the Resource group tile from Microsoft. Select Create on the Resource group page.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-multi-subnet/01-resource-group-search.png" alt-text="Screenshot of the Azure portal, Marketplace, with resource group in the search box, and resource group selected. ":::
-
On the Create a resource group page, fill out the values to create the resource group:
- Choose the appropriate Azure subscription from the drop-down.
- Provide a name for your resource group, such as SQL-HA-RG.
- Choose a region from the drop-down, such as West US 2. Be sure to deploy all subsequent resources to this location as well.
- Select Review + create to review your resource parameters, and then select Create to create your resource group.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-multi-subnet/01-resource-group-create-complete.png" alt-text="Screenshot the Azure portal, Create a resource group page, filling out the values to create your resource group.":::
The next step is to create the networks and subnet in the Azure resource group.
The solution uses one virtual network and one subnet. The Virtual network overview provides more information about networks in Azure.
To create the virtual network in the Azure portal, follow these steps:
-
Go to your resource group in the Azure portal and select + Create
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-multi-subnet/02-create-resource-rg.png" alt-text="Screenshot the Azure portal, Resource group page, with +Create selected.":::
-
Search for virtual network in the Marketplace search box and choose the virtual network tile from Microsoft. Select Create on the Virtual network page.
-
On the Create virtual network page, enter the following information on the Basics tab:
- Under Project details, choose the appropriate Azure Subscription, and the Resource group you created previously, such as SQL-HA-RG.
- Under Instance details, provide a name for your virtual network, such as autoHAVNET, and choose the same region as your resource group from the drop-down.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/03-create-vnet-basics.png" alt-text="Screenshot of the Azure portal, create virtual network page, providing a name for your virtual network, such as autoHAVNET." lightbox="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/03-create-vnet-basics.png":::
-
On the IP addresses tab, select the "..." next to + Add a subnet and select Delete address space to remove the existing address space, if you need a different address range.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/04-delete-address-space.png" alt-text="Screenshot the Azure portal, create virtual network page, with ellipses selected and delete address space highlighted.":::
-
Select Add an IP address space to open the blade to create the address space you need. For this tutorial, the address space of 192.168.0.0/16 is being used. Select Add to create the address space.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/05-add-address-space.png" alt-text="Screenshot of the Azure portal, Add an IP address space page, showing adding a new address space." lightbox="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/05-add-address-space.png" :::
-
Select + Add a subnet
- Provide a value for the Subnet name, such as Admin
- Provide a unique subnet address range within the virtual network address space.
- For example, if your address range is 192.168.0.0/16, enter the IP address range
192.168.15.0/24for the *Admin subnet.
- For example, if your address range is 192.168.0.0/16, enter the IP address range
- Select Add to add your new subnet.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/06-configure-virtual-network.png" alt-text="Screenshot of the Azure portal, add a subnet page, showing how to add a subnet." lightbox="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/06-configure-virtual-network.png":::
-
Select Review + Create.
Azure returns you to the portal dashboard and notifies you when the new network is created.
Before you create virtual machines, you need to create availability sets. Availability sets reduce the downtime for planned or unplanned maintenance events. An Azure availability set is a logical group of resources that Azure places on physical fault domains and update domains. A fault domain ensures that the members of the availability set have separate power and network resources. An update domain ensures that members of the availability set aren't brought down for maintenance at the same time. For more information, see Manage the availability of virtual machines.
You need two availability sets. One is for the domain controllers. The second is for the SQL Server VMs.
To create an availability set, go to the resource group and select Add. Filter the results by typing availability set. Select Availability Set in the results, and then select Create.
Configure two availability sets according to the parameters in the following table:
| Field | Domain controller availability set | SQL Server availability set |
|---|---|---|
| Name | adavailabilityset | sqlavailabilityset |
| Resource group | SQL-HA-RG | SQL-HA-RG |
| Fault domains | 3 | 3 |
| Update domains | 5 | 3 |
After you create the availability sets, return to the resource group in the Azure portal.
After you've created the network, subnet, and availability sets, you're ready to create the virtual machines for the domain controllers.
To create and configure the domain controllers, return to the SQL-HA-RG resource group.
- Select Add.
- Type Windows Server 2016 Datacenter.
- Select Windows Server 2016 Datacenter. In Windows Server 2016 Datacenter, verify that the deployment model is Resource Manager, and then select Create.
Repeat the preceding steps to create two virtual machines. Name the two virtual machines:
-
ad-primary-dc
-
ad-secondary-dc
[!NOTE] The ad-secondary-dc virtual machine is optional, to provide high availability for Active Directory Domain Services.
The following table shows the settings for these two machines:
| Field | Value |
|---|---|
| Name | First domain controller: ad-primary-dc. Second domain controller ad-secondary-dc. |
| VM disk type | SSD |
| User name | DomainAdmin |
| Password | Contoso!0000 |
| Subscription | Your subscription |
| Resource group | SQL-HA-RG |
| Location | Your location |
| Size | DS1_V2 |
| Storage | Use managed disks - Yes |
| Virtual network | autoHAVNET |
| Subnet | admin |
| Public IP address | Same name as the VM |
| Network security group | Same name as the VM |
| Availability set | adavailabilityset Fault domains:3 Update domains:5 |
| Diagnostics | Enabled |
| Diagnostics storage account | Automatically created |
Important
You can only place a VM in an availability set when you create it. You can't change the availability set after a VM is created. See Manage the availability of virtual machines.
Azure creates the virtual machines.
After the virtual machines are created, configure the domain controller.
In the following steps, configure the ad-primary-dc machine as a domain controller for corp.contoso.com.
-
In the portal, open the SQL-HA-RG resource group and select the ad-primary-dc machine. On ad-primary-dc, select Connect to open an RDP file for remote desktop access.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/20-connect-rdp.png" alt-text="Screenshot Azure portal, virtual machine page, showing how to connect to a virtual machine.":::
-
Sign in with your configured administrator account (\DomainAdmin) and password (Contoso!0000).
-
By default, the Server Manager dashboard should be displayed.
-
Select the Add roles and features link on the dashboard.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/22-add-features.png" alt-text="Screenshot of Server Manager, Dashboard, selecting the Add roles and features link.":::
-
Select Next until you get to the Server Roles section.
-
Select the Active Directory Domain Services and DNS Server roles. When you're prompted, add any additional features that are required by these roles.
[!NOTE] Windows warns you that there is no static IP address. If you're testing the configuration, select Continue. For production scenarios, set the IP address to static in the Azure portal, or use PowerShell to set the static IP address of the domain controller machine.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/23-add-roles.png" alt-text="Screenshot of Add roles and features wizard, selecting the Active Directory Domain Services and DNS Server roles.":::
-
Select Next until you reach the Confirmation section. Select the Restart the destination server automatically if required check box.
-
Select Install.
-
After the features finish installing, return to the Server Manager dashboard.
-
Select the new AD DS option on the left-hand pane.
-
Select the More link on the yellow warning bar.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/24-ad-ds-more.png" alt-text="Screenshot of Server Manager, the AD DS tab, showing the configure DNS Server VM message, with more highlighted.":::
-
In the Action column of the All Server Task Details dialog, select Promote this server to a domain controller.
-
In the Active Directory Domain Services Configuration Wizard, use the following values:
Page Setting Deployment Configuration Add a new forest
Root domain name = corp.contoso.comDomain Controller Options DSRM Password = Contoso!0000
Confirm Password = Contoso!0000 -
Select Next to go through the other pages in the wizard. On the Prerequisites Check page, verify that you see the following message: All prerequisite checks passed successfully. You can review any applicable warning messages, but it's possible to continue with the installation.
-
Select Install. The ad-primary-dc virtual machine automatically reboots.
Use the primary domain controller for DNS. Note the primary domain controller IP address.
One way to get the primary domain controller IP address is through the Azure portal.
-
On the Azure portal, open the resource group.
-
Select the primary domain controller.
-
On the primary domain controller, select Network interfaces.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/25-primary-dc-ip.png" alt-text="Screenshot of the Azure portal, network interfaces of the virtual machine page, with the private ip address highlighted.":::
Note the private IP address for this server.
After you create the first domain controller and enable DNS on the first server, configure the virtual network to use this server for DNS.
-
In the Azure portal, select the virtual network.
-
Under Settings, select DNS Server.
-
Select Custom, and type the private IP address of the primary domain controller.
-
Select Save.
After the primary domain controller reboots, you can configure the second domain controller. This optional step is for high availability. Follow these steps to configure the second domain controller:
-
In the portal, open the SQL-HA-RG resource group and select the ad-secondary-dc machine. On ad-secondary-dc, select Connect to open an RDP file for remote desktop access.
-
Sign in to the VM by using your configured administrator account (BUILTIN\DomainAdmin) and password (Contoso!0000).
-
Change the preferred DNS server address to the address of the domain controller.
-
In Network and Sharing Center, select the network interface.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/26-network-interface.png" alt-text="Screenshot of the Network and Sharing center, selecting the Ethernet2 network interface on the VM.":::
-
Select Properties.
-
Select Internet Protocol Version 4 (TCP/IPv4) and then select Properties.
-
Select Use the following DNS server addresses and then specify the address of the primary domain controller in Preferred DNS server.
-
Select OK, and then Close to commit the changes. You're now able to join the VM to corp.contoso.com.
[!IMPORTANT] If you lose the connection to your remote desktop after changing the DNS setting, go to the Azure portal and restart the virtual machine.
-
From the remote desktop to the secondary domain controller, open Server Manager Dashboard.
-
Select the Add roles and features link on the dashboard.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/22-add-features.png" alt-text="Screenshot of Server Manager dashboard tab, selecting the Add roles and features link on the VM.":::
-
Select Next until you get to the Server Roles section.
-
Select the Active Directory Domain Services and DNS Server roles. When you're prompted, add any additional features that are required by these roles.
-
After the features finish installing, return to the Server Manager dashboard.
-
Select the new AD DS option on the left-hand pane.
-
Select the More link on the yellow warning bar.
-
In the Action column of the All Server Task Details dialog, select Promote this server to a domain controller.
-
Under Deployment Configuration, select Add a domain controller to an existing domain.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/28-deployment-config.png" alt-text="Screenshot of the Active Directory Domain Services Configuration Wizard, domain controller deployment configuration.":::
-
Select Select.
-
Connect by using the administrator account (CORP.CONTOSO.COM\domainadmin) and password (Contoso!0000).
-
In Select a domain from the forest, choose your domain and then select OK.
-
In Domain Controller Options, use the default values and set a DSRM password.
[!NOTE] The DNS Options page might warn you that a delegation for this DNS server can't be created. You can ignore this warning in non-production environments.
-
Select Next until the dialog reaches the Prerequisites check. Then select Install.
After the server finishes the configuration changes, restart the server.
In the Azure portal, under virtual network, change the DNS Server to include the IP address of the secondary domain controller. This setting allows the DNS service redundancy.
In the next steps, you configure the Active Directory accounts. The following table shows the accounts:
| Installation account |
sqlserver-0 SQL Server and SQL Agent Service account |
sqlserver-1 SQL Server and SQL Agent Service account |
|
|---|---|---|---|
| First Name | Install | SQLSvc1 | SQLSvc2 |
| User SamAccountName | Install | SQLSvc1 | SQLSvc2 |
Use the following steps to create each account.
-
Sign in to the ad-primary-dc machine.
-
In Server Manager, select Tools, and then select Active Directory Administrative Center.
-
Select corp (local) from the left pane.
-
On the right Tasks pane, select New, and then select User.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/29-ad-dc-new-user.png" alt-text="Screenshot of the Active Directory Administrative Center in the VM, showing to add a new user." lightbox="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/29-ad-dc-new-user.png" :::
[!TIP] Set a complex password for each account.
For non-production environments, set the user account to never expire. -
Select OK to create the user.
-
Repeat the preceding steps for each of the three accounts.
-
In the Active Directory Administrative Center, select corp (local) in the left pane. Then in the right-hand Tasks pane, select Properties.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/31-ad-dc-properties.png" alt-text="Screenshot of the Active Directory Administrative Center, CORP user properties selected." lightbox="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/31-ad-dc-properties.png" :::
-
Select Extensions, and then select the Advanced button on the Security tab.
-
In the Advanced Security Settings for corp dialog, select Add.
-
Select Select a principal, search for CORP\Install, and then select OK.
-
Select the Read all properties check box.
-
Select the Create Computer objects check box.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/33-add-permissions.png" alt-text="Screenshot of the corp user permissions UI." lightbox="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/33-add-permissions.png" :::
-
Select OK, and then select OK again. Close the corp properties window.
Now that you've finished configuring Active Directory and the user objects, create two SQL Server VMs and a witness server VM. Then join all three to the domain.
Create three additional virtual machines. The solution requires two virtual machines with SQL Server instances. A third virtual machine will function as a witness. Windows Server 2016 can use a cloud witness. However for consistency with previous operating systems, this article uses a virtual machine for a witness.
Before you proceed consider the following design decisions.
-
Storage - Azure Managed Disks
For the virtual machine storage, use Azure Managed Disks. Microsoft recommends Managed Disks for SQL Server virtual machines. Managed Disks handles storage behind the scenes. In addition, when virtual machines with Managed Disks are in the same availability set, Azure distributes the storage resources to provide appropriate redundancy. For more information, see Azure Managed Disks Overview. For specifics about managed disks in an availability set, see Use Managed Disks for VMs in an availability set.
-
Network - Private IP addresses in production
For the virtual machines, this tutorial uses public IP addresses. A public IP address enables remote connection directly to the virtual machine over the internet and makes configuration steps easier. In production environments, Microsoft recommends only private IP addresses in order to reduce the vulnerability footprint of the SQL Server instance VM resource.
-
Network - Recommend a single NIC per server
Use a single NIC per server (cluster node) and a single subnet. Azure networking has physical redundancy, which makes additional NICs and subnets unnecessary on an Azure virtual machine guest cluster. The cluster validation report will warn you that the nodes are reachable only on a single network. You can ignore this warning on Azure virtual machine guest failover clusters.
Next, create three VMs - two SQL Server VMs and one VM for an additional cluster node. To create each of the VMs, go back to the SQL-HA-RG resource group, and then select Add. Search for the appropriate gallery item, select Virtual Machine, and then select From Gallery. Use the information in the following table to help you create the VMs:
| Page | VM1 | VM2 | VM3 |
|---|---|---|---|
| Select the appropriate gallery item | Windows Server 2016 Datacenter | SQL Server 2016 SP1 Enterprise on Windows Server 2016 | SQL Server 2016 SP1 Enterprise on Windows Server 2016 |
| Virtual machine configuration Basics | Name = cluster-fsw User Name = DomainAdmin Password = Contoso!0000 Subscription = Your subscription Resource group = SQL-HA-RG Location = Your Azure location |
Name = sqlserver-0 User Name = DomainAdmin Password = Contoso!0000 Subscription = Your subscription Resource group = SQL-HA-RG Location = Your Azure location |
Name = sqlserver-1 User Name = DomainAdmin Password = Contoso!0000 Subscription = Your subscription Resource group = SQL-HA-RG Location = Your Azure location |
| Virtual machine configuration Size | SIZE = DS1_V2 (1 vCPU, 3.5 GB) | SIZE = DS2_V2 (2 vCPUs, 7 GB) The size must support SSD storage (Premium disk support.) |
SIZE = DS2_V2 (2 vCPUs, 7 GB) |
| Virtual machine configuration Settings | Storage: Use managed disks. Virtual network = autoHAVNET Subnet = admin(192.168.15.0/24) Public IP address automatically generated. Network security group = None Monitoring Diagnostics = Enabled Diagnostics storage account = Use an automatically generated storage account Availability set = sqlAvailabilitySet |
Storage: Use managed disks. Virtual network = autoHAVNET Subnet = admin(192.168.15.0/24) Public IP address automatically generated. Network security group = None Monitoring Diagnostics = Enabled Diagnostics storage account = Use an automatically generated storage account Availability set = sqlAvailabilitySet |
Storage: Use managed disks. Virtual network = autoHAVNET Subnet = admin(192.168.15.0/24) Public IP address automatically generated. Network security group = None Monitoring Diagnostics = Enabled Diagnostics storage account = Use an automatically generated storage account Availability set = sqlAvailabilitySet |
| Virtual machine configuration SQL Server settings | Not applicable | SQL connectivity = Private (within Virtual Network) Port = 1433 SQL Authentication = Disable Storage configuration = General Automated patching = Sunday at 2:00 Automated backup = Disabled Azure Key Vault integration = Disabled |
SQL connectivity = Private (within Virtual Network) Port = 1433 SQL Authentication = Disable Storage configuration = General Automated patching = Sunday at 2:00 Automated backup = Disabled Azure Key Vault integration = Disabled |
Note
The machine sizes suggested here are meant for testing availability groups in Azure Virtual Machines. For the best performance on production workloads, see the recommendations for SQL Server machine sizes and configuration in Performance best practices for SQL Server in Azure Virtual Machines.
After the three VMs are fully provisioned, you need to join them to the corp.contoso.com domain and grant CORP\Install administrative rights to the machines.
You're now able to join the VMs to corp.contoso.com. Do the following steps for both the SQL Server VMs and the file share witness server:
- Remotely connect to the virtual machine with BUILTIN\DomainAdmin.
- In Server Manager, select Local Server.
- Select the WORKGROUP link.
- In the Computer Name section, select Change.
- Select the Domain check box and type corp.contoso.com in the text box. Select OK.
- In the Windows Security popup dialog, specify the credentials for the default domain administrator account (CORP\DomainAdmin) and the password (Contoso!0000).
- When you see the "Welcome to the corp.contoso.com domain" message, select OK.
- Select Close, and then select Restart Now in the popup dialog.
Add the installation account as an administrator on each VM, grant permission to the installation account and local accounts within SQL Server, and update the SQL Server service account.
After each virtual machine restarts as a member of the domain, add CORP\Install as a member of the local administrators group.
-
Wait until the VM is restarted, then launch the RDP file again from the primary domain controller to sign in to sqlserver-0 by using the CORP\DomainAdmin account.
[!TIP] Make sure that you sign in with the domain administrator account. In the previous steps, you were using the BUILT IN administrator account. Now that the server is in the domain, use the domain account. In your RDP session, specify DOMAIN\username.
-
In Server Manager, select Tools, and then select Computer Management.
-
In the Computer Management window, expand Local Users and Groups, and then select Groups.
-
Double-click the Administrators group.
-
In the Administrators Properties dialog, select the Add button.
-
Enter the user CORP\Install, and then select OK.
-
Select OK to close the Administrator Properties dialog.
-
Repeat the previous steps on sqlserver-1 and cluster-fsw.
Use the installation account (CORP\install) to configure the availability group. This account needs to be a member of the sysadmin fixed server role on each SQL Server VM. The following steps create a sign-in for the installation account:
-
Connect to the server through the Remote Desktop Protocol (RDP) by using the <MachineName>\DomainAdmin account.
-
Open SQL Server Management Studio and connect to the local instance of SQL Server.
-
In Object Explorer, select Security.
-
Right-click Logins. Select New Login.
-
In Login - New, select Search.
-
Select Locations.
-
Enter the domain administrator network credentials.
-
Use the installation account (CORP\install).
-
Set the sign-in to be a member of the sysadmin fixed server role.
-
Select OK.
Repeat the preceding steps on the other SQL Server VM.
To create an account for the system account and grant appropriate permissions, complete the following steps on each SQL Server instance:
-
Create an account for
[NT AUTHORITY\SYSTEM]on each SQL Server instance. The following script creates this account:USE [master] GO CREATE LOGIN [NT AUTHORITY\SYSTEM] FROM WINDOWS WITH DEFAULT_DATABASE=[master] GO
-
Grant the following permissions to
[NT AUTHORITY\SYSTEM]on each SQL Server instance:ALTER ANY AVAILABILITY GROUPCONNECT SQLVIEW SERVER STATE
The following script grants these permissions:
GRANT ALTER ANY AVAILABILITY GROUP TO [NT AUTHORITY\SYSTEM] GO GRANT CONNECT SQL TO [NT AUTHORITY\SYSTEM] GO GRANT VIEW SERVER STATE TO [NT AUTHORITY\SYSTEM] GO
On each SQL Server VM, set the SQL Server service account. Use the accounts that you created when you configured the domain accounts.
- Open SQL Server Configuration Manager.
- Right-click the SQL Server service, and then select Properties.
- Set the account and password.
- Repeat these steps on the other SQL Server VM.
For SQL Server availability groups, each SQL Server VM needs to run as a domain account.
To add Failover Clustering features, do the following steps on both SQL Server VMs:
-
Connect to the SQL Server virtual machine through the Remote Desktop Protocol (RDP) by using the CORP\install account. Open Server Manager Dashboard.
-
Select the Add roles and features link on the dashboard.
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/22-add-features.png" alt-text="Screenshot of Server manager dashboard tab, select the Add roles and features link on the dashboard on the SQL Server VM.":::
-
Select Next until you get to the Server Features section.
-
In Features, select Failover Clustering.
-
Add any additional required features.
-
Select Install to add the features.
Repeat the steps on the other SQL Server VM.
Note
This step, along with actually joining the SQL Server VMs to the failover cluster, can now be automated with Azure SQL VM CLI and Azure Quickstart Templates.
When running Windows Failover Cluster nodes in Azure VMs with SQL Server availability groups, change the cluster setting to a more relaxed monitoring state. This will make the cluster much more stable and reliable. For details on this, see IaaS with SQL Server - Tuning Failover Cluster Network Thresholds.
The solution requires the following TCP ports to be open in the firewall:
- SQL Server VM: Port 1433 for a default instance of SQL Server.
- Azure load balancer probe: Any available port. Examples frequently use 59999.
- Cluster core load balancer IP address health probe: Any available port. Examples frequently use 58888.
- Database mirroring endpoint: Any available port. Examples frequently use 5022.
The firewall ports need to be open on both SQL Server VMs.
The method of opening the ports depends on the firewall solution that you use. The next section explains how to open the ports in Windows Firewall. Open the required ports on each of your SQL Server VMs.
-
On the first SQL Server Start screen, launch Windows Firewall with Advanced Security.
-
On the left pane, select Inbound Rules. On the right pane, select New Rule.
-
For Rule Type, choose Port.
-
For the port, specify TCP and type the appropriate port numbers. See the following example:
:::image type="content" source="./media/availability-group-manually-configure-prerequisites-tutorial-single-subnet/35-tcp-ports.png" alt-text="Screenshot of the New Inbound Rule Wizard for the SQL firewall, showing specific local ports.":::
-
Select Next.
-
On the Action page, keep Allow the connection selected, and then select Next.
-
On the Profile page, accept the default settings, and then select Next.
-
On the Name page, specify a rule name (such as Azure LB Probe) in the Name text box, and then select Finish.
Repeat these steps on the second SQL Server VM.
Now that you've configured the prerequisites, get started with configuring your availability group
To learn more, see: