Backup retention and recovery: the basics
What actually decides how far back you can restore an Azure SQL database?
Azure SQL Database backs every database up automatically, but how recoverable a database really is comes down to three settings that are easy to leave on their defaults. The first is the point-in-time restore window: the short-term retention policy, which can be set from 1 to 35 days and defaults to 7. Inside that window you can restore to any second. Outside it, the backups are simply gone. The second is where those backups live: by default they sit in geo-redundant storage replicated to the paired region, but a database can be created or changed to use locally or zone-redundant storage, which is cheaper and silently disables geo-restore. The third is long-term retention, which is off until you turn it on and lets you keep weekly, monthly and yearly full backups for up to 10 years.
These read as three unrelated knobs, but they are one capability: how far back, and from where, can you recover when something goes wrong. A seven-day window is fine for a fat-finger delete noticed the same morning. It is no help at all against a logical corruption or a bad migration discovered three weeks later, or an auditor who needs the year-end state of a financial database from four years ago. Each gap is a different shape of the same risk, the inability to recover to the point you actually need.
Most of this is drift rather than intent. A database provisioned with the default 7-day window because nobody changed it, a cost-saving module that set locally redundant backup storage and quietly removed the ability to recover in a second region, a long-term retention policy that was never configured because no recovery requirement was ever written down. The work is to decide, per database, how far back you need to be able to recover and from where, then set retention, storage redundancy and long-term retention to match, rather than inheriting whatever the defaults happened to be.
In this lesson you will learn how Azure SQL Database expresses recoverability through three settings: the short-term point-in-time restore window, backup storage redundancy, and long-term retention. You will see how to find every database whose retention does not match its importance, and how to set retention, redundancy and long-term retention deliberately rather than inheriting the defaults, all without affecting the running workload.
The seven-day cliff
The most common backup surprise in Azure SQL is not a missing backup, it is a backup that expired. Point-in-time restore defaults to a 7-day window, and inside it you can recover to any single second. The cliff is the edge: a logical corruption or a bad data migration is often not noticed for two or three weeks, by which time every backup that pre-dates the damage has rolled off. The backups were always there and always working. The window was simply shorter than the time it took to discover the problem, which is exactly the failure long-term retention and a longer point-in-time window exist to prevent.
Finding databases whose retention does not match their importance
Priya runs reliability for a fintech platform heading into an audit and a disaster-recovery exercise at the same time. The team has dozens of Azure SQL databases, most provisioned over three years by different squads, and nobody is sure which ones still run on the default 7-day window or on local-only backup storage.
Rather than open each database in the portal, Priya starts by reading the short-term retention policy and the backup storage redundancy straight from the control plane, so the databases whose recoverability does not match their importance can be separated from the ones that are already configured deliberately.
Read the point-in-time restore window for a database, then check where its backups are stored. A short window plus local-only storage is the least recoverable combination.
A short restore window plus locally redundant backup storage is the least recoverable configuration. On a database that matters, fix the window and the redundancy first, then add long-term retention.
How Azure SQL backup retention and recovery actually workdeep dive
Azure SQL Database takes full, differential and transaction-log backups continuously, and the short-term retention policy decides how long they are kept: any value from 1 to 35 days, defaulting to 7. Within that window you can restore to any single second, because the service replays log backups to the moment you choose. The differential backup frequency, either every 12 or 24 hours, is a secondary knob that affects restore granularity and storage. Extend the window and you extend the period over which a late-discovered problem is still recoverable, at the cost of more backup storage.
Where those backups physically live is a separate property, the backup storage redundancy, and it is the one that quietly governs disaster recovery. Geo-redundant storage, the default, replicates backups to the Azure paired region, so geo-restore can rebuild the database elsewhere if the primary region has an outage. Geo-redundant replication is asynchronous, so the geo-restore recovery point can lag the primary by up to an hour. Switch a database to locally or zone-redundant storage and the backup-storage bill drops, but geo-restore is disabled: the backups never leave the region, so a regional outage takes your recovery path with it. You can change the redundancy on an existing database, but it is not instant and can take up to 48 hours to apply.
Long-term retention is a third, independent policy. It copies the weekly, monthly and yearly full backups into separate storage and keeps them for as long as you specify, up to 10 years, expressed as ISO 8601 durations such as P12W, P12M and P10Y plus the week of the year for the yearly backup. It exists for recoverability and compliance horizons that the 35-day point-in-time window can never reach, and the backups can optionally be made immutable so they cannot be deleted before their retention expires. Setting all three deliberately is the difference between a database that is backed up and a database you can actually recover to the point, and from the place, you need.
What is the impact of leaving retention on its defaults?
The direct impact is an outage you cannot fully recover from. A database on a 7-day window, hit by a logical corruption or a bad migration found three weeks later, has no clean backup left to restore: every backup that pre-dates the damage has already expired. The recovery stops being a restore and becomes hours or days of manual data reconstruction, with the business down or running on degraded data the whole time. The backups worked perfectly. The window was just shorter than the time it took to notice the problem.
The second-order impact is regional blast radius. A database whose backups were switched to locally or zone-redundant storage to save money has no geo-restore: if the primary region has a bad day, the backups are stuck in the same region as the failure, so the outage and the recovery path go down together. Geo-redundant storage is what turns a regional incident from an unrecoverable event into a geo-restore in the paired region, accepting the documented recovery-point lag of up to an hour.
On the compliance and recoverability side, many regulated workloads must be able to produce a database's state from years ago: a year-end financial position, a record retained for a statutory period. The 35-day point-in-time window cannot reach that horizon, and long-term retention is the only mechanism that can, with immutability available where the data must be provably unaltered. A retention posture set deliberately per database is both the recovery insurance and the audit artefact.
How do you set retention and recovery deliberately?
Work the capability as one loop rather than turning every knob to maximum. The order matters: decide the recovery requirement per database first, so you buy retention where downtime is expensive and not where it is not.
1. Inventory every database by its current recoverability
For each database, read the point-in-time restore window (short-term retention), the backup storage redundancy, and whether long-term retention is configured. Treat this inventory as the source of truth. A short window plus locally redundant storage with no long-term retention is the least recoverable combination and the first to look at.
2. Attach a recovery requirement to each database
Decide, per database, how far back you need to recover and from where. A revenue-bearing system needs a long window, geo-redundant storage and probably long-term retention. A database that can be rebuilt from source in an afternoon is genuinely fine on the default 7-day, geo-redundant setting. Size retention to the cost of downtime, not to a single estate-wide rule.
3. Set the window and the redundancy, then add long-term retention
Extend the short-term window towards 35 days where late discovery is a real risk, keep or restore geo-redundant backup storage so geo-restore stays available, and configure long-term retention for the weekly, monthly and yearly states that compliance or recoverability needs. Remember a redundancy change can take up to 48 hours to apply, so plan it ahead of any audit or DR exercise.
4. Make the standard repeatable
Bake the chosen retention, redundancy and long-term retention into the Bicep or Terraform that provisions databases, so new databases inherit a deliberate posture rather than the bare defaults. Where data must be provably unaltered for its full retention, enable immutable long-term backups so they cannot be deleted before expiry.
# 1. Extend the point-in-time restore window to 35 days on a database that matters.
# Valid retention is 1-35 days; diff backup frequency is 12 or 24 hours.
az sql db str-policy set \
--resource-group rg-fin-prod \
--server sql-fin-prod \
--name ledger \
--retention-days 35 \
--diffbackup-hours 12
# 2. Restore geo-redundant backup storage so geo-restore stays available.
# Geo-restore is disabled on Local/Zone redundancy. Change can take up to 48h.
az sql db update \
--resource-group rg-fin-prod \
--server sql-fin-prod \
--name ledger \
--backup-storage-redundancy Geo
# 3. Add long-term retention for the states compliance needs (up to 10 years),
# optionally immutable so backups cannot be deleted before they expire.
az sql db ltr-policy set \
--resource-group rg-fin-prod \
--server sql-fin-prod \
--name ledger \
--weekly-retention P12W \
--monthly-retention P12M \
--yearly-retention P7Y \
--week-of-year 1 \
--make-backups-immutable Enabled Quick quiz
Question 1 of 5A production Azure SQL database is left on the default short-term retention. How far back can you restore it to a point in time, and what is the risk?
You scored
0 / 5
Keep learning
Go deeper on how Azure SQL Database expresses recoverability across the point-in-time window, backup storage redundancy and long-term retention.
- Automated backups in Azure SQL Database How automated backups, retention and backup storage redundancy work, including geo-restore.
- Change automated backup settings for Azure SQL Database Set the short-term point-in-time retention window and the backup storage redundancy.
- Manage long-term backup retention for Azure SQL Database Configure weekly, monthly and yearly long-term retention for up to 10 years, with immutability.
You can now treat Azure SQL backup retention as one recoverability capability rather than three defaults: inventory each database's restore window, backup storage redundancy and long-term retention, attach a recovery requirement based on what its downtime would cost, set the window and redundancy deliberately, and add long-term retention where compliance or recoverability needs years. Backups are not the same as recovery, and the gap between them is the settings you choose.
Back to the library