Exam objective 5.2 — Configure disaster recovery for Azure SQL — is about one fear every database administrator loses sleep over: what happens when your database suddenly disappears? A single server failure, a natural disaster in the data centre's region, or a human error that deletes critical tables could destroy your entire application. This chapter explains the backup plans Azure gives you, how they work, and exactly what you need to know to pass DP-300 questions on keeping your data safe when everything goes wrong.
Jump to a section
A simple way to picture Configuring Disaster Recovery for Azure SQL
A commercial kitchen's walk-in cooler is the heart of the operation. It keeps hundreds of kilograms of expensive, perishable ingredients at a safe temperature. If the cooler fails, the chef loses the stock, the dinner service is ruined, and the business takes a massive financial hit. That is why every serious restaurant installs a backup generator. When the main power cuts, the generator starts automatically, keeping the cooler running so the food stays cold. The chef can keep cooking without interruption. This is active geo-replication: a second, fully operational database in a different Azure region that takes over instantly if the primary fails.
But a generator is expensive to run and maintain. A smaller restaurant might instead keep a stash of dry ice in the freezer. If the power goes out, they rush the dry ice into the cooler to keep things cold while they wait for repairs. That is a geo-restore: restoring a backup from a different region. It is cheaper but takes time, and you might not save everything. Finally, some restaurants sign a contract with a catering truck. If the cooler dies, the truck parks outside and the chef moves food there. The truck is always running, but switching over requires a phone call. That is failover groups: you manually or automatically switch to a secondary database that is kept in sync, but the switch itself requires a deliberate action. Each disaster recovery method is a different tool, matched to the restaurant's budget and how much risk they can stomach.
Disaster recovery (DR) is the set of mechanisms you put in place to ensure your database survives a catastrophic failure. A 'catastrophic failure' is not a crashed hard drive — that is a hardware fault. A disaster is something that takes out an entire Azure region: a major earthquake, a flood, a power grid failure, or even a large-scale cyberattack. When a whole region goes down, every database in that region becomes unavailable. Your job is to have a copy of your data running somewhere else, ready to serve traffic immediately or be brought online quickly.
Azure SQL Database and SQL Managed Instance both offer several ways to configure this. The first and most common is geo-redundant backup storage. When you create a database, Azure automatically backs it up every few minutes, and copies those backups to a paired region hundreds of kilometres away. If the primary region fails, you can restore from those backups — this is called geo-restore. It is free (the backups are included in your service cost), but it has a downside: the restore can take hours, especially if the disaster is widespread and many customers are trying to restore at once. The data loss window is also up to one hour, meaning you could lose the last hour of transactions.
For businesses that cannot afford an hour of lost data or hours of downtime, there is active geo-replication. This creates a second, readable copy of your database in a different Azure region. Your application can read from the secondary copy at any time, and if the primary fails, you perform a manual failover to promote the secondary to become the new primary. The failover happens within seconds. The catch is that you pay for the secondary database separately — it is a full, running database, not just a backup. The replication is asynchronous, which means changes on the primary are sent to the secondary with a small delay. If a disaster happens during that delay, a few transactions might be lost.
The next level is failover groups. A failover group is a management layer on top of active geo-replication. It lets you group one or more databases and define a single endpoint — a connection string — that your application always uses. The failover group handles the switching of endpoints automatically. You can configure automatic failover policies: if Azure detects that the primary region is down for a certain period (your grace period, typically one hour), it triggers the failover automatically. The application does not need to know which database is primary; it just connects to the same endpoint. Failover groups also support readable secondaries, so you can offload read traffic to the secondary database to distribute load.
For SQL Managed Instance, the equivalent is auto-failover groups. They work the same way but are designed for the managed instance architecture. You create a secondary instance in a different region, and the group manages replication and failover between the two. The key difference is that managed instances require a VPN gateway or Azure ExpressRoute connection between the two regions for replication traffic to flow.
There is also a cheaper, less capable option called a zone-redundant configuration. This does not protect against a full region failure, only against a failure of a single Azure data centre within that region. It replicates data across multiple 'availability zones' inside the same region. If a data centre burns down, your database stays up. But if the entire region suffers a disaster, zone redundancy does not help.
Each option makes a trade-off between the Recovery Point Objective (RPO) and the Recovery Time Objective (RTO). RPO is how much data you are willing to lose — measured in time. If the RPO is 5 seconds, you can lose at most 5 seconds of new data. RTO is how long it takes to get the database back online. Geo-restore has an RTO of hours and an RPO of up to one hour. Failover groups can achieve an RTO of under a minute and an RPO of a few seconds. You pick the combination that matches your business's tolerance for data loss and downtime.
All of these configurations are configured through the Azure portal, Azure CLI, or PowerShell. You must also consider networking: for failover groups, you need to configure firewall rules and virtual network settings so that the secondary database accepts connections from the same clients. And you must test your failover process regularly. There is no point having a DR system if nobody has ever practised failing over, or if the application's connection string is hardcoded to the old primary server.
1. Assess your business requirements
Determine the RPO (how much data you can lose measured in time) and RTO (how long you can be offline) for your database. This drives which DR method is appropriate. For example, a banking app needs RPO of seconds and RTO of minutes, while a reporting database might tolerate hours of both.
2. Create a secondary server or instance in a different Azure region
For Azure SQL Database, create a new logical server in a paired region. For SQL Managed Instance, create a managed instance in another region. Ensure the region is paired correctly so Azure's geo-redundant storage works optimally. The secondary server must have the same or higher performance tier as the primary.
3. Configure the failover group or active geo-replication
In the Azure portal, create a failover group and add your databases to it. The group will set up continuous replication. For active geo-replication, you manually initiate replication from the primary database to the secondary. The group method is preferred for multiple databases because it provides a single listener endpoint.
4. Set the failover policy and grace period
Choose between manual and automatic failover. If you choose automatic, configure the grace period — the time Azure waits after detecting a primary outage before triggering failover. A typical value is 1 hour. This prevents false failovers from short-lived network issues.
5. Update application connection strings to use the failover group listener
Point your application's database connection string to the failover group listener endpoint (e.g., 'mygroup.database.windows.net'). The listener always resolves to the current primary database, so after a failover the application automatically connects to the new primary without any code changes.
6. Test the failover process regularly
Perform a manual failover in a maintenance window to verify the RTO is met and the application functions correctly on the secondary. Document the results and practise the failback process (returning to the original primary after the disaster is resolved). This step is often overlooked but is critical for exam scenarios asking what 'must be done after configuring DR'.
First, you go to the Azure portal and locate your PayFast database server in West Europe. You open the failover groups blade and create a new failover group. You give it a name like 'payfast-dr-group'. You select the secondary server: you need a server already created in North Europe. If one does not exist, you create it. The portal asks you to choose a failover policy. You choose 'Automatic' and set a grace period of 1 hour. Why 1 hour? Because if there is a brief connectivity blip, you do not want automatic failover to trigger unnecessarily. If West Europe truly is down for an hour, the failover will happen automatically.
Next, you add the PayFast database to the failover group. The portal will start the initial seeding — copying the full database from West Europe to North Europe. This can take hours for large databases, so you schedule it during low traffic. While seeding is running, the secondary database is not usable. Once seeding finishes, continuous asynchronous replication begins. Every few seconds, changes on the primary are sent to the secondary. The RPO will typically be under 10 seconds, well within the 30-second business requirement.
You then update all application connection strings to point to the failover group listener endpoint — something like 'payfast-dr-group.database.windows.net'. The listener is a DNS name that always resolves to the current primary database. If a failover occurs, Azure updates the DNS record so the listener points to the new primary in Ireland. The application does not need to change its connection string.
Finally, you simulate a disaster. You trigger a manual failover during a maintenance window to test the RTO. You measure: from the moment you initiate the failover, how long until the application can successfully connect to the new primary and process a test payment? You find it takes 45 seconds. The RTO of 5 minutes is easily met. You repeat the test every quarter. The operations team documents the test results, and you sleep better knowing that the business is protected. This is the real-world workflow for configuring disaster recovery for Azure SQL.
RPO vs RTO definitions and how each DR method maps to them.
Geo-restore only works if the backup is geo-redundant (the default is GRS, but you can change it).
Active geo-replication requires you to create and pay for the secondary database manually.
Failover groups include a listener endpoint that automatically updates DNS on failover.
Failover groups support automatic failover with a configurable grace period.
Auto-failover groups for SQL Managed Instance require a VPN or ExpressRoute connection between the two instances.
You cannot use a secondary database in a failover group for writes — only reads.
The failover grace period is the time Azure waits after detecting a primary outage before triggering automatic failover.
Expect questions that give you a table of RPO/RTO requirements and ask you to choose the cheapest or most appropriate solution. Also expect questions that present a failure scenario and ask what happens to the data — for example, 'If the primary database fails during asynchronous replication, what transactions are lost?' The answer is the transactions that were committed on the primary but not yet replicated to the secondary.
Finally, the exam loves to test whether you know that zone-redundant configuration does not protect against a region failure. A question might say: 'A company wants to protect against a single data centre failure within a single region. Which configuration should they use?' The answer is zone-redundant, not geo-replication. Do not mix up availability zones (within one region) with geo-replication (across regions).
Geo-restore recovers a database from geo-redundant backups but can take hours and may lose up to an hour of data.
Active geo-replication maintains a fully readable secondary database in a different region that can be failed over in seconds.
Failover groups provide a listener endpoint that automatically updates DNS after a failover, so your application does not need a new connection string.
Zone-redundant configuration protects against a single data centre failure within one region, not against a full region outage.
The failover grace period in an automatic failover policy prevents unnecessary failovers from temporary network interruptions.
For SQL Managed Instance, auto-failover groups require a VPN gateway or ExpressRoute connection between the two instances.
The secondary database in a failover group is always read-only until a failover promotes it to primary.
You must test your disaster recovery plan regularly to ensure the RTO is met and the application works correctly after failover.
These come up on the exam all the time. Here's how to tell them apart.
Geo-restore
Restores from automatically stored backup files
RPO can be up to 1 hour (data loss possible)
RTO measured in hours (takes time to restore)
Active geo-replication
Maintains a live, continuously updating secondary database
RPO typically under 10 seconds
RTO measured in seconds (failover is quick)
Active geo-replication
Requires manual management of individual database failovers
No automatic listener endpoint — you update connection strings manually
Supports multiple secondaries per primary
Failover groups
Manages replication for multiple databases as a single logical group
Provides a listener endpoint that automatically updates DNS on failover
Supports automatic failover with a configurable grace period
Failover groups
Replicates data across different Azure regions
Protects against a full region failure
Requires separate billing for the secondary database
Zone-redundant configuration
Replicates data across availability zones within a single region
Protects only against a data centre failure, not a region failure
No additional billing — it is part of the database service level
Failover groups for Azure SQL Database
Works with logical servers and databases
No VPN or ExpressRoute required for replication traffic
Replication uses Azure's internal network
Auto-failover groups for SQL Managed Instance
Works with managed instances
Requires a VPN gateway or ExpressRoute connection between the two instances
Replication traffic must traverse a configured network connection
Mistake
Geo-restore and active geo-replication are the same thing because both restore from a backup in another region.
Correct
Geo-restore restores from geo-redundant backups, which are point-in-time snapshots. It can take hours and you may lose up to an hour of data. Active geo-replication maintains a live, continuously updated secondary database that can be failed over in seconds.
Both involve 'geo' and 'restore/replicate', so beginners lump them together. The exam tests the functional difference between restoring from a backup and failing over to a live replica.
Mistake
A failover group automatically fails over as soon as the primary region has a problem.
Correct
Automatic failover only triggers after a grace period (default 1 hour) that you configure. This prevents unnecessary failovers from transient network glitches. You can also manually trigger a failover at any time.
People assume 'automatic' means immediate, but Azure builds in a delay to avoid flapping between regions. The exam asks about the grace period and its purpose.
Mistake
The secondary database in a failover group can be used for read and write operations after a failover.
Correct
Before a failover, the secondary is read-only. After a failover, the old secondary becomes the new primary and accepts both reads and writes. The old primary becomes the new secondary and is read-only.
Beginners think a secondary is a full live replica that can do everything. In reality, it is a read-only copy until a failover promotes it.
Mistake
Zone-redundant configuration protects against a full region outage.
Correct
Zone-redundant configuration replicates data across availability zones within a single Azure region. If the entire region fails (e.g., due to a natural disaster), zone redundancy offers no protection. You need geo-replication for region-level protection.
The word 'redundant' sounds like it covers everything. The exam tricks candidates by asking for a solution that protects against a region failure, and zone-redundant seems plausible but is incorrect.
Mistake
Failover groups automatically replicate all databases on a server without any additional setup.
Correct
You must explicitly add each database to the failover group. The group does not automatically include every database on the server. Also, databases with certain features like data masking or encryption may have additional requirements.
Beginners assume 'group' means everything is grouped together automatically. The exam tests that you know you have to manually add databases to the group.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Geo-restore recovers a database from automatically stored geo-redundant backups. It can take hours and you may lose up to an hour of data. Geo-replication (active geo-replication or failover groups) maintains a live, synchronised secondary database that can be switched to in seconds.
No. The secondary database is read-only until a failover promotes it to primary. This is by design to prevent data consistency issues.
A manual failover typically completes in under one minute. Automatic failover takes the same amount of time after the grace period expires. The exact time depends on the database size and workload.
Yes — you must update the connection string to use the failover group listener endpoint. After that, no application changes are needed during a failover.
The old primary becomes a new secondary database. It is read-only and synchronises with the new primary. When the original region is healthy again, you can fail back to it.
No. Zone-redundant configuration protects only against a single data centre failure within a region. It does not protect against a full region outage, which is what disaster recovery is about. You need geo-replication for that.
You've finished Configuring Disaster Recovery for Azure SQL. Continue through the DP-300 study guide to build a complete picture of the exam.
Done with this chapter?