Overview of Azure SQL Database failover groups

Failover groups provide a disaster recovery solution for your Azure SQL databases by enabling automatic or manual failover of a set of databases to a secondary region. This document explains how to create, manage, and configure failover groups for Azure SQL Database.

Key Concepts

Benefits

Creating a Failover Group

You can create a failover group using the Azure portal, Azure CLI, Azure PowerShell, or REST API. Here's a high-level overview of the steps:

  1. Navigate to your primary Azure SQL server in the Azure portal.
  2. Under the 'High Availability' section, select 'Failover groups'.
  3. Click 'Create failover group'.
  4. Configure the failover group name, secondary server, and databases to include.
  5. Review and create the failover group.

Managing a Failover Group

Once created, you can manage your failover group through the Azure portal or programmatically:

Important: When creating a failover group, ensure that the secondary server is in a different Azure region than the primary server for true disaster recovery.

Connecting to Databases in a Failover Group

Applications should connect to the read-write listener endpoint of the failover group. This endpoint automatically directs connections to the current primary database, regardless of whether a failover has occurred. The listener's hostname remains the same.

Example connection string using the listener endpoint:

Server=tcp:your_failover_group_listener.database.windows.net;Database=your_database;User ID=your_user;Password=your_password;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;

Monitoring and Alerts

Azure SQL Database provides metrics and logs that you can use to monitor the health and status of your failover groups. Configure alerts to be notified of important events, such as failover initiations or errors.