Prerequisites
All droplets must be within an Azure Resource Group, configured with a valid name and location.
Auto-failover Groups are supported cross-region only. If you would like in-region high availability with Azure SQL, check out the Cloud Maker Geo-replication tutorial.
Here is an overview of the differences between Azure SQL geo-replication and auto-failover groups:
Capability | Geo-replication | Auto-failover Groups |
Automatic Failover | No | Yes |
Failover multiple databases simultaneously | No | Yes |
Managed instance supported | No | Yes |
Supports read-scale | Yes | Yes |
Update connection string after failover | Yes | No |
Can be in same region | Yes | No |
Multiple replicas | Yes | No |
Example Topology
This tutorial takes you through creating a simple network infrastructure, an Azure Virtual Machine and Azure SQL Servers configured to use auto-failover groups to replicate the primary Azure SQL database in Region A to a secondary Azure SQL database in Region B.
If you have followed the Azure SQL - Service Endpoint tutorial, you will have some of this topology designed already.
Note: This example would be part of a larger design. For instance, additional network and server resources would be deployed in Region B. As well as this, further network configuration would be required on the Azure Virtual Machine.
The purpose of this tutorial is to demonstrate configuring auto-failover groups for Azure SQL. Please reach out if you would like further information.
Add the Azure Resource Groups and primary Azure SQL server
First we will drag, drop & configure our Azure Resource Groups and then we will add the primary Azure SQL server to Resource Group A and configure a new database.
Drag & drop two Azure Resource Groups onto your blueprint
On the Properties Panel set the Name and Location for Resource Group A
Set the Name and Location for Resource Group B (auto-failover groups require Resource Group B to be in a different region to Resource Group A. Microsoft recommend that Region Pairs are used for a High Availability configuration)
Drag & drop an Azure SQL instance into Resource Group A
Set the name of the Azure SQL Server (this can only be lowercase, numbers, and hyphens)
Set the Administrator Login Name
Set the Secret Parameter for the Administrator Login Password
Select 'Databases' and create a new database by clicking 'Add new Database'
Set the name for the database, e.g. mydatabase (this can only be lowercase, numbers, and hyphens)
Set the 'Edition' property to Basic (the 'Edition' property is the main influence on the cost of deploying Azure SQL Server. Unless you have any specific requirements we recommend using the Basic edition)
We will come back to our primary Azure SQL Server in a later step to enable auto-failover groups.
Add the secondary Azure SQL Server to Resource Group B
We now need to add our secondary Azure SQL server to our design.
Note: Auto-failover groups provides a cross-region high availability solution for your Azure SQL Databases. If you require in-region resilience you can follow the Cloud Maker Azure SQL geo-replication tutorial here.
Drag & drop your second Azure SQL instance into Resource Group B
Set the name of the Azure SQL Server (this can only be lowercase, numbers, and hyphens)
Set the Administrator Login Name
Set the Secret Parameter for the Administrator Login Password
Great! You've now added both Azure SQL servers to your design. The final step is to configure auto-failover groups on the Primary Azure SQL server.
Configure auto-failover groups on the primary Azure SQL server
The final step is to configure auto-failover groups on our primary Azure SQL Server. You can read more about auto-failover groups here.
Select your primary Azure SQL Server in Region A
Select 'Failover Groups' from the property tree
Click 'Add new Failover Group'
Set the Name of your failover group
Click 'Add new Database'
From the drop-down menu select the database you created earlier
Click 'Add new Partner Server' and select the secondary Azure SQL server
Click 'Read Write Endpoint'
Set 'Failover Policy' to automatic
Set 'Failover With Data Loss Grace Period Minutes' to 5
That's it; you've successfully configured you primary and secondary Azure SQL servers with auto-failover groups.
Optional: Build your network and VM infrastructure
Now we've design and configured our Azure SQL auto-failover topology, we can build our network infrastructure for use in conjunction with Azure SQL Server. You can also see our Service Endpoints tutorial for creating a secure connection between Azure SQL and your subnet.
Drag & drop an Azure Virtual Network into Resource Group A
Set the Name for your Virtual Network and check the Address Space is as required
Drag & drop an Azure Subnet into your Virtual Network (this will automatically add an NSG)
Set the Name for your NSG
Set the Name for your Subnet and check the Address Prefix is as required
Drag & drop an Azure Virtual Machine into the Subnet
Set the Name for the Virtual Machine
Under 'Storage Profile' set the OS Disk Name for the Virtual Machine
Under 'Network Interfaces' set the Network Interface Card Name for the Virtual Machine
Under 'OS Profile' set the Computer Name, Admin Username and Password secret parameter for the Virtual Machine