Skip to content

Commit 5278587

Browse files
Merge pull request #111242 from MashaMSFT/20200413_miltr
20200413 miltr
2 parents 8c9fb90 + 9bcfdb6 commit 5278587

5 files changed

+180
-13
lines changed

articles/sql-database/sql-database-long-term-backup-retention-configure.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Manage long-term backup retention
3-
description: "Learn how to store automated backups in the SQL Azure storage and then restore them"
2+
title: "Single database: Manage long-term backup retention"
3+
description: "Learn how to store and restore automated backups for an Azure SQL Database single or pooled database in Azure storage (for up to 10 years) using the Azure Portal and PowerShell"
44
services: sql-database
55
ms.service: sql-database
66
ms.subservice: backup-restore
@@ -11,7 +11,7 @@ author: anosov1960
1111
ms.author: sashan
1212
ms.reviewer: mathoma, carlrab
1313
manager: craigg
14-
ms.date: 08/21/2019
14+
ms.date: 04/14/2020
1515
---
1616

1717
# Manage Azure SQL Database long-term backup retention
@@ -183,7 +183,7 @@ Remove-AzSqlDatabaseLongTermRetentionBackup -ResourceId $ltrBackup.ResourceId
183183
```
184184

185185
> [!IMPORTANT]
186-
> 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](../azure-monitor/platform/alerts-activity-log.md) for detailed instructions.
186+
> 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](../azure-monitor/platform/alerts-activity-log.md) for detailed instructions.
187187
188188
### Restore from LTR backups
189189

articles/sql-database/sql-database-long-term-retention.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Store backups for up to 10 years
3-
description: Learn how Azure SQL Database supports storing full database backups for up to 10 years.
2+
title: "Long-term backup retention"
3+
description: Learn how Azure SQL Database supports storing full database backups for up to 10 years via the long-term retention policy.
44
services: sql-database
55
ms.service: sql-database
66
ms.subservice: backup-restore
@@ -12,13 +12,15 @@ ms.author: sashan
1212
ms.reviewer: mathoma, carlrab
1313
ms.date: 05/18/2019
1414
---
15-
# Store Azure SQL Database backups for up to 10 years
15+
# Azure SQL Database long-term retention
1616

17-
Many applications have regulatory, compliance, or other business purposes that require you to retain database backups beyond the 7-35 days provided by Azure SQL Database [automatic backups](sql-database-automated-backups.md). By using the long-term retention (LTR) feature, you can store specified SQL database full backups in Azure Blob storage with read-access geo-redundant storage for up to 10 years. You can then restore any backup as a new database. For more information about Azure Storage redundancy, see [Azure Storage redundancy](../storage/common/storage-redundancy.md).
17+
Many applications have regulatory, compliance, or other business purposes that require you to retain database backups beyond the 7-35 days provided by Azure SQL Database [automatic backups](sql-database-automated-backups.md). By using the long-term retention (LTR) feature, you can store specified SQL database full backups in Azure Blob storage with read-access geo-redundant storage for up to 10 years. You can then restore any backup as a new database. For more information about Azure Storage redundancy, see [Azure Storage redundancy](../storage/common/storage-redundancy.md).
18+
19+
Long time retention can be enabled for single and pooled databases, and is in limited public preview for Azure SQL Database managed instances.
1820

1921
> [!NOTE]
20-
> LTR can be enabled for single and pooled databases. It is not yet available for instance databases in Managed Instances. You can use SQL Agent jobs to schedule [copy-only database backups](https://docs.microsoft.com/sql/relational-databases/backup-restore/copy-only-backups-sql-server) as an alternative to LTR beyond 35 days.
21-
>
22+
> You can use SQL Agent jobs to schedule [copy-only database backups](https://docs.microsoft.com/sql/relational-databases/backup-restore/copy-only-backups-sql-server) as an alternative to LTR beyond 35 days.
23+
2224

2325
## How SQL Database long-term retention works
2426

@@ -69,6 +71,16 @@ If you are using active geo-replication or failover groups as your business cont
6971
> [!NOTE]
7072
> When the original primary database recovers from an outage that caused the failover, it will become a new secondary. Therefore, the backup creation will not resume and the existing LTR policy will not take effect until it becomes the primary again.
7173
74+
## Managed Instance support
75+
76+
Using long-term backup retention with an Azure SQL Database managed instances has the following limitations:
77+
78+
- **Limited public preview** - This preview is only available to EA and CSP subscriptions and is subject to limited availability.
79+
- [**PowerShell only**](sql-database-managed-instance-long-term-backup-retention-configure.md) - There is currently no Azure portal support. LTR must be enabled using PowerShell.
80+
81+
To request enrollment, create an [Azure support ticket](https://azure.microsoft.com/support/create-ticket/) under the support topic **Backup, Restore, and Business continuity / Long-term backup retention**.
82+
83+
7284
## Configure long-term backup retention
7385

7486
To learn how to configure long-term retention using the Azure portal or PowerShell, see [Manage Azure SQL Database long-term backup retention](sql-database-long-term-backup-retention-configure.md).
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
---
2+
title: "Managed instance: Long-term backup retention (PowerShell)"
3+
description: "Learn how to store and restore automated backups on separate Azure Blob storage containers for an Azure SQL Database managed instance using PowerShell."
4+
services: sql-database
5+
ms.service: sql-database
6+
ms.subservice: backup-restore
7+
ms.custom:
8+
ms.devlang:
9+
ms.topic: conceptual
10+
author: anosov1960
11+
ms.author: sashan
12+
ms.reviewer: mathoma, carlrab
13+
manager: craigg
14+
ms.date: 04/14/2020
15+
---
16+
# Manage Azure SQL Database managed instance long-term backup retention (PowerShell)
17+
18+
In Azure SQL Database managed instance, you can configure a [long-term backup retention](sql-database-long-term-retention.md#managed-instance-support) policy (LTR) as a limited public preview feature. This allows you to to automatically retain database backups in separate Azure Blob storage containers for up to 10 years. You can then recover a database using these backups using PowerShell.
19+
20+
> [!IMPORTANT]
21+
> LTR for managed instances is currently in limited preview and available for EA and CSP subscriptions on a case by case basis. To request enrollment, please create an [Azure support ticket](https://azure.microsoft.com/support/create-ticket/) under the support topic **Backup, Restore, and Business Continuity/Long-term backup retention**.
22+
23+
24+
The following sections show you how to use PowerShell to configure the long-term backup retention, view backups in Azure SQL storage, and restore from a backup in Azure SQL storage.
25+
26+
## RBAC roles to manage long-term retention
27+
28+
For **Get-AzSqlInstanceDatabaseLongTermRetentionBackup** and **Restore-AzSqlInstanceDatabase**, you will need to have one of the following roles:
29+
30+
- Subscription Owner role or
31+
- SManaged Instance Contributor role or
32+
- Custom role with the following permissions:
33+
34+
```Microsoft.Sql/locations/longTermRetentionManagedInstanceBackups/read```
35+
```Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionManagedInstanceBackups/read```
36+
```Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/read```
37+
38+
For **Remove-AzSqlInstanceDatabaseLongTermRetentionBackup**, you will need to have one of the following roles:
39+
40+
- Subscription Owner role or
41+
- Custom role with the following permission:
42+
43+
```Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/delete```
44+
45+
> [!NOTE]
46+
> The SManaged Instance Contributor role does not have permission to delete LTR backups.
47+
48+
RBAC permissions could be granted in either *subscription* or *resource group* scope. However, to access LTR backups that belong to a dropped instance, the permission must be granted in the *subscription* scope of that instance.
49+
50+
```Microsoft.Sql/locations/longTermRetentionManagedInstances/longTermRetentionDatabases/longTermRetentionManagedInstanceBackups/delete```
51+
52+
## Create an LTR policy
53+
54+
```powershell
55+
# get the Managed Instance
56+
$subId = "<subscriptionId>"
57+
$instanceName = "<instanceName>"
58+
$resourceGroup = "<resourceGroupName>"
59+
$dbName = "<databaseName>"
60+
61+
Connect-AzAccount
62+
Select-AzSubscription -SubscriptionId $subId
63+
64+
$instance = Get-AzSqlInstance -Name $instanceName -ResourceGroupName $resourceGroup
65+
66+
# create LTR policy with WeeklyRetention = 12 weeks. MonthlyRetention and YearlyRetention = 0 by default.
67+
Set-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy -InstanceName $instanceName `
68+
-DatabaseName $dbName -ResourceGroupName $resourceGroup -WeeklyRetention P12W
69+
70+
# create LTR policy with WeeklyRetention = 12 weeks, YearlyRetention = 5 years and WeekOfYear = 16 (week of April 15). MonthlyRetention = 0 by default.
71+
Set-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy -InstanceName $instanceName `
72+
-DatabaseName $dbName -ResourceGroupName $resourceGroup -WeeklyRetention P12W -YearlyRetention P5Y -WeekOfYear 16
73+
74+
```
75+
76+
## View LTR policies
77+
78+
This example shows how to list the LTR policies within an instance
79+
80+
```powershell
81+
# gets the current version of LTR policy for the database
82+
$ltrPolicies = Get-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy -InstanceName $instanceName `
83+
-DatabaseName $dbName -ResourceGroupName $resourceGroup
84+
85+
```
86+
87+
## Clear an LTR policy
88+
89+
This example shows how to clear an LTR policy from a database
90+
91+
```powershell
92+
Set-AzSqlInstanceDatabaseBackupLongTermRetentionPolicy -InstanceName $instanceName `
93+
-DatabaseName $dbName -ResourceGroupName $resourceGroup -RemovePolicy
94+
```
95+
96+
## View LTR backups
97+
98+
This example shows how to list the LTR backups within an instance.
99+
100+
```powershell
101+
# get the list of all LTR backups in a specific Azure region
102+
# backups are grouped by the logical database id, within each group they are ordered by the timestamp, the earliest backup first
103+
$ltrBackups = Get-AzSqlInstanceDatabaseLongTermRetentionBackup -Location $instance.Location
104+
105+
# get the list of LTR backups from the Azure region under the given managed instance
106+
$ltrBackups = Get-AzSqlInstanceDatabaseLongTermRetentionBackup -Location $instance.Location -InstanceName $instanceName
107+
108+
# get the LTR backups for a specific database from the Azure region under the given managed instance
109+
$ltrBackups = Get-AzSqlInstanceDatabaseLongTermRetentionBackup -Location $instance.Location -InstanceName $instanceName -DatabaseName $dbName
110+
111+
# list LTR backups only from live databases (you have option to choose All/Live/Deleted)
112+
$ltrBackups = Get-AzSqlInstanceDatabaseLongTermRetentionBackup -Location $instance.Location -DatabaseState Live
113+
114+
# only list the latest LTR backup for each database
115+
$ltrBackups = Get-AzSqlInstanceDatabaseLongTermRetentionBackup -Location $instance.Location -InstanceName $instanceName -OnlyLatestPerDatabase
116+
117+
```
118+
119+
## Delete LTR backups
120+
121+
This example shows how to delete an LTR backup from the list of backups.
122+
123+
```powershell
124+
# remove the earliest backup
125+
$ltrBackup = $ltrBackups[0]
126+
Remove-AzSqlInstanceDatabaseLongTermRetentionBackup -ResourceId $ltrBackup.ResourceId
127+
```
128+
129+
> [!IMPORTANT]
130+
> Deleting LTR backup is non-reversible. To delete an LTR backup after the instance 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](../azure-monitor/platform/alerts-activity-log.md) for detailed instructions.
131+
132+
## Restore from LTR backups
133+
134+
This example shows how to restore from an LTR backup. Note, this interface did not change but the resource id parameter now requires the LTR backup resource id.
135+
136+
```powershell
137+
# restore a specific LTR backup as an P1 database on the instance $instanceName of the resource group $resourceGroup
138+
Restore-AzSqlInstanceDatabase -FromLongTermRetentionBackup -ResourceId $ltrBackup.ResourceId `
139+
-TargetInstanceName $instanceName -TargetResourceGroupName $resourceGroup -TargetInstanceDatabaseName $dbName
140+
141+
```
142+
143+
> [!IMPORTANT]
144+
> To restore from an LTR backup after the instance has been deleted, you must have permissions scoped to the subscription of the instance and that subscription must be active. You must also omit the optional -ResourceGroupName parameter.
145+
146+
> [!NOTE]
147+
> 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. See [point in time restore](sql-database-recovery-using-backups.md#point-in-time-restore).
148+
149+
## Next steps
150+
151+
- To learn about service-generated automatic backups, see [automatic backups](sql-database-automated-backups.md)
152+
- To learn about long-term backup retention, see [long-term backup retention](sql-database-long-term-retention.md)

articles/sql-database/sql-database-release-notes.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: sql-database
77
ms.subservice: service
88
ms.devlang:
99
ms.topic: conceptual
10-
ms.date: 04/09/2020
10+
ms.date: 04/14/2020
1111
ms.author: sstein
1212
---
1313
# SQL Database release notes
@@ -43,6 +43,7 @@ This article lists SQL Database features that are currently in public preview. F
4343
| <a href="https://aka.ms/managed-instance-aadlogins">Instance-level Azure AD server principals (logins)</a> | Create server-level logins using <a href="https://docs.microsoft.com/sql/t-sql/statements/create-login-transact-sql?view=azuresqldb-mi-current">CREATE LOGIN FROM EXTERNAL PROVIDER</a> statement. |
4444
| [Transactional Replication](sql-database-managed-instance-transactional-replication.md) | Replicate the changes from your tables into other databases placed on Managed Instances, Single Databases, or SQL Server instances, or update your tables when some rows are changed in other Managed Instances or SQL Server instance. For information, see [Configure replication in an Azure SQL Database managed instance database](replication-with-sql-database-managed-instance.md). |
4545
| Threat detection |For information, see [Configure threat detection in Azure SQL Database managed instance](sql-database-managed-instance-threat-detection.md).|
46+
| Long-term backup retention | For information, see [Configure long-term back up retention in Azure SQL Database managed instance](sql-database-managed-instance-long-term-backup-retention-configure.md). |
4647

4748
---
4849

@@ -110,7 +111,7 @@ If failover group spans across instances in different Azure subscriptions or res
110111

111112
### SQL Agent roles need explicit EXECUTE permissions for non-sysadmin logins
112113

113-
If non-sysadmin logins are added to any of [SQL Agent fixed database roles](https://docs.microsoft.com/sql/ssms/agent/sql-server-agent-fixed-database-roles), there exists an issue in which explicit EXECUTE permissions need to be granted to the master stored procedures for these logins to work. If this issue is encountered, the error message The EXECUTE permission was denied on the object <object_name> (Microsoft SQL Server, Error: 229) will be shown.
114+
If non-sysadmin logins are added to any of [SQL Agent fixed database roles](https://docs.microsoft.com/sql/ssms/agent/sql-server-agent-fixed-database-roles), there exists an issue in which explicit EXECUTE permissions need to be granted to the master stored procedures for these logins to work. If this issue is encountered, the error message "The EXECUTE permission was denied on the object <object_name> (Microsoft SQL Server, Error: 229)" will be shown.
114115

115116
**Workaround**: Once you add logins to either of SQL Agent fixed database roles: SQLAgentUserRole, SQLAgentReaderRole or SQLAgentOperatorRole, for each of the logins added to these roles execute the below T-SQL script to explicitly grant EXECUTE permissions to the stored procedures listed.
116117

@@ -163,7 +164,7 @@ Cross-database Service Broker dialogs will stop delivering the messages to the s
163164
### Impersonification of Azure AD login types is not supported
164165

165166
Impersonation using `EXECUTE AS USER` or `EXECUTE AS LOGIN` of following AAD principals is not supported:
166-
- Aliased AAD users. The following error is returned in this case `15517`.
167+
- Aliased AAD users. The following error is returned in this case `15517`.
167168
- AAD logins and users based on AAD applications or service principals. The following errors are returned in this case `15517` and `15406`.
168169

169170
### @query parameter not supported in sp_send_db_mail

articles/sql-database/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,8 @@
740740
href: sql-database-managed-instance-configure-vm.md
741741
- name: Point-to-site connection
742742
href: sql-database-managed-instance-configure-p2s.md
743+
- name: Long-term backup retention
744+
href: sql-database-managed-instance-long-term-backup-retention-configure.md
743745
- name: Load data
744746
items:
745747
- name: Restore database backup

0 commit comments

Comments
 (0)