- Article
Applies to: Azure SQL Database
- Azure SQL Database
- Azure SQL Managed Instance
With Azure SQL Database, you can set a long-term backup retention (LTR) policy to automatically retain backups in separate Azure Blob storage containers for up to 10 years. You can then recover a database using these backups using the Azure portal, Azure CLI, or PowerShell.
Prerequisites
- Portal
- Azure CLI
- PowerShell
An active Azure subscription.
Permissions
To view and restore LTR backups, you need:
Subscription Owner role or
Subscription Contributor role or
SQL Server Contributor role or
Custom role with the following permissions:
Microsoft.Sql/locations/longTermRetentionBackups/read
Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionBackups/read
Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups/read
To delete LTR backups, you need to be a member of one of the following roles:
Subscription Owner role or
Subscription Contributor role or
Custom role with the following permission:
Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups/delete
Note
The SQL Server Contributor role does not have permission to delete LTR backups.
Azure role-based access control (RBAC) permissions could be granted in either subscription or resource group scope. However, to access LTR backups that belong to a dropped server, this permission must be granted in the subscription scope of that server:
Microsoft.Sql/locations/longTermRetentionServers/longTermRetentionDatabases/longTermRetentionBackups/delete
Create long-term retention policies
- Portal
- Azure CLI
- PowerShell
You can configure SQL Database to retain automated backups for a period longer than the retention period for your service tier.
In the Azure portal, navigate to your server and then select Backups. Select the Retention policies tab to modify your backup retention settings.
On the Retention policies tab, select the database(s) on which you want to set or modify long-term backup retention policies. Unselected databases will not be affected.
In the Configure policies pane, specify your desired retention period for weekly, monthly, or yearly backups. Choose a retention period of '0' to indicate that no long-term backup retention should be set.
Select Apply to apply the chosen retention settings to all selected databases.
Important
When you enable a long-term backup retention policy, it may take up to 7 days for the first backup to become visible and available to restore. For details of the LTR backup cadence, see long-term backup retention.
View backups and restore from a backup
View the backups that are retained for a specific database with an LTR policy, and restore from those backups.
- Portal
- Azure CLI
- PowerShell
In the Azure portal, navigate to your server and then select Backups. To view the available LTR backups for a specific database, select Manage under the Available LTR backups column. A pane appears with a list of the available LTR backups for the selected database.
In the Available LTR backups pane that appears, review the available backups. Select a backup to restore from.
To restore from an available LTR backup, select the backup from which you want to restore, and then select Restore.
Choose a name for your new database, then select Review + Create to review the details of your Restore. Select Create to restore your database from the chosen backup.
On the toolbar, select the notification icon to view the status of the restore job.
When the restore job is completed, open the SQL databases page to view the newly restored database.
Note
From here, you can connect to the restored database using SQL Server Management Studio to perform needed tasks, such as to extract a bit of data from the restored database to copy into the existing database or to delete the existing database and rename the restored database to the existing database name.
Delete LTR backups
Delete backups that are retained for a specific database with an LTR policy.
Important
Deleting LTR backup is non-reversible. To delete an LTR backup after the server has been deleted you must have Subscription scope permission. You can set up notifications about each delete in Azure Monitor by filtering for operation 'Deletes a long term retention backup'. The activity log contains information on who and when made the request. See Create activity log alerts for detailed instructions.
- Portal
- Azure CLI
- PowerShell
- In the Azure portal, navigate to the logical server of the Azure SQL Database.
- Select Backups. To view the available LTR backups for a specific database, select Manage under the Available LTR backups column. A pane appears with a list of the available LTR backups for the selected database.
- In the Available LTR backups pane that appears, review the available backups. Select a backup to delete. Select Delete.
Best practices
If you use LTR backups to meet compliance or other mission-critical requirements:
- Verify the LTR backups are taken as per the configured policy by following steps outlined in view backups section either using Portal, Azure CLI or PowerShell.
- Consider conducting periodic recovery drills to verify that restore of LTR backups results in expected database state.
Related content
- To learn about service-generated automatic backups, see automatic backups
- To learn about long-term backup retention, see long-term backup retention