Concepts
To configure active geo-replication in Microsoft Azure SQL Solution, you can follow these steps:
Step 1: Create a Source and Target Database
You need to create a source database and a target database in Azure SQL. The source database will act as the primary database, and the target database will be the secondary database in a different region.
Step 2: Enable Active Geo-Replication
To enable active geo-replication for your databases, you can use the Azure portal, PowerShell, or Azure CLI.
Using the Azure portal:
- Open the Azure portal and navigate to your source database.
- In the left menu, select “Geo-Replication.”
- Click on “Add Secondary” and select your target database.
- Choose the target region for your secondary database and click “OK.”
- Click on “Apply.”
Using PowerShell:
$primaryServer = ‘
$secondaryServer = ‘
$primaryDatabase = ‘
$secondaryDatabase = ‘
$resourceGroupName = ‘
$subscriptionId = ‘
Set-AzSqlDatabaseSecondary -ResourceGroupName $resourceGroupName `
-ServerName $primaryServer -DatabaseName $primaryDatabase `
-PartnerResourceGroupName $resourceGroupName `
-PartnerServerName $secondaryServer -PartnerDatabaseName $secondaryDatabase `
-SecondaryType GeoDRDatabase `
-SubscriptionId $subscriptionId
Using Azure CLI:
az sql db replica create –name
Step 3: Monitor Active Geo-Replication
You can monitor the active geo-replication status and progress using the Azure portal, PowerShell, or Azure CLI.
Using the Azure portal:
- Open the Azure portal and navigate to your source database.
- In the left menu, select “Geo-Replication.”
- You can view the replication status and lag time in the portal.
Using PowerShell:
$primaryServer = ‘
$primaryDatabase = ‘
$resourceGroupName = ‘
$geoReplication = Get-AzSqlDatabaseGeoBackup `
-ResourceGroupName $resourceGroupName `
-ServerName $primaryServer `
-DatabaseName $primaryDatabase
$geoReplication
Using Azure CLI:
az sql db replica list-links –name
Step 4: Failover and Failback
In case of a disaster or planned maintenance, you might need to failover to your secondary database or failback to the primary database. You can perform these operations using the Azure portal, PowerShell, or Azure CLI.
Using the Azure portal:
- Open the Azure portal and navigate to your source database.
- In the left menu, select “Geo-Replication.”
- Click on “Failover” or “Failback” as per your requirement.
Using PowerShell:
$primaryServer = ‘
$secondaryServer = ‘
$primaryDatabase = ‘
$secondaryDatabase = ‘
$resourceGroupName = ‘
Failover-AzSqlDatabaseSecondary -ResourceGroupName $resourceGroupName `
-ServerName $primaryServer -DatabaseName $primaryDatabase `
-PartnerResourceGroupName $resourceGroupName `
-PartnerServerName $secondaryServer -PartnerDatabaseName $secondaryDatabase
Failover-AzSqlDatabaseSecondary -ResourceGroupName $resourceGroupName `
-ServerName $secondaryServer -DatabaseName $secondaryDatabase `
-PartnerResourceGroupName $resourceGroupName `
-PartnerServerName $primaryServer -PartnerDatabaseName $primaryDatabase
Using Azure CLI:
az sql db replica set-primary –server
By following these steps and using the Azure portal, PowerShell, or Azure CLI, you can easily configure and manage active geo-replication for your Azure SQL Solution. This ensures high availability and disaster recovery for your databases across different regions.
Answer the Questions in Comment Section
Which of the following is required to configure active geo-replication for an Azure SQL database?
A. The source and target databases must be in the same region.
B. The source and target databases must have the same edition and service tier.
C. The source database must have read access enabled.
D. Only databases using Azure SQL Managed Instance can be configured for active geo-replication.
Correct answer: B
True or False: Active geo-replication can be configured between databases in different Azure subscriptions.
Correct answer: True
What is the maximum number of readable secondary replicas that can be configured for an Azure SQL database with active geo-replication?
A. 1
B. 2
C. 4
D. 8
Correct answer: C
Which of the following actions can be performed on readable secondary replicas in an active geo-replication setup? (Select all that apply.)
A. Modify the schema of the database.
B. Run read-only queries.
C. Backup the database.
D. Create new tables.
Correct answers: B, C
True or False: Failover from the primary to a secondary replica in an active geo-replication configuration is an automatic process.
Correct answer: False
Which of the following statements about the secondary replica in an active geo-replication configuration is true? (Select all that apply.)
A. It can be located in a different Azure region.
B. It can be used for read-intensive workloads.
C. It can be changed to become the new primary in case of a failure.
D. It can be accessed using the same connection string as the primary database.
Correct answers: A, B, C, D
True or False: Active geo-replication automatically synchronizes all data modifications from the primary to the secondary replicas in real-time.
Correct answer: False
Which of the following is an advantage of using active geo-replication for disaster recovery?
A. Reduced network latency for read operations.
B. Automatic failover and zero data loss.
C. Increased storage capacity for the primary database.
D. Simplified management of user permissions.
Correct answer: B
True or False: Backup and restore operations can be performed on the secondary replica in an active geo-replication configuration.
Correct answer: False
What happens to the secondary replicas when a source database is deleted?
A. The secondary replicas are automatically converted to new primary databases.
B. The secondary replicas are deleted along with the source database.
C. The secondary replicas become read-only and can no longer be written to.
D. The secondary replicas continue to function independently as secondary databases.
Correct answer: B
Great blog post on configuring active geo-replication!
Thanks for the detailed instructions, very helpful!
Can anyone explain the failover process in active geo-replication?
How do I monitor the health of my geo-replicated databases?
Appreciate the step-by-step guide!
Does this configuration support automatic failover?
What is the RTO and RPO for active geo-replication?
Very clear instructions, thank you!