Skip to content

Commit 82695d9

Browse files
committed
Merge remote
2 parents 326eb46 + d2e382a commit 82695d9

File tree

2 files changed

+130
-25
lines changed

2 files changed

+130
-25
lines changed

src/Sql/Sql/help/Get-AzSqlDatabaseLongTermRetentionBackup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Accept wildcard characters: True
209209
```
210210
211211
### -DatabaseName
212-
The name of the Azure SQL Database the backup is from.
212+
The name of the Azure SQL database the backups are under.
213213
214214
```yaml
215215
Type: System.String

src/Sql/Sql/help/Set-AzSqlDatabaseBackupLongTermRetentionPolicy.md

Lines changed: 129 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
external help file: Microsoft.Azure.PowerShell.Cmdlets.Sql.dll-Help.xml
33
Module Name: Az.Sql
4-
online version: https://learn.microsoft.com/powershell/module/az.sql/set-azsqldatabasebackuplongtermretentionpolicy
4+
online version:
55
schema: 2.0.0
66
---
77

@@ -14,31 +14,35 @@ Sets a server long term retention policy.
1414

1515
### WeeklyRetentionRequired (Default)
1616
```
17-
Set-AzSqlDatabaseBackupLongTermRetentionPolicy -WeeklyRetention <String> [-ServerName] <String>
18-
[-DatabaseName] <String> [-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf]
19-
[-Confirm] [<CommonParameters>]
17+
Set-AzSqlDatabaseBackupLongTermRetentionPolicy -WeeklyRetention <String> [-TimeBasedImmutability <String>]
18+
[-TimeBasedImmutabilityMode <String>] [-ServerName] <String> [-DatabaseName] <String>
19+
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>]
20+
[-WhatIf] [-Confirm] [<CommonParameters>]
2021
```
2122

2223
### RemovePolicy
2324
```
24-
Set-AzSqlDatabaseBackupLongTermRetentionPolicy [-RemovePolicy] [-ServerName] <String> [-DatabaseName] <String>
25-
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
26-
[<CommonParameters>]
25+
Set-AzSqlDatabaseBackupLongTermRetentionPolicy [-RemovePolicy] [-TimeBasedImmutability <String>]
26+
[-TimeBasedImmutabilityMode <String>] [-ServerName] <String> [-DatabaseName] <String>
27+
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>]
28+
[-WhatIf] [-Confirm] [<CommonParameters>]
2729
```
2830

2931
### MonthlyRetentionRequired
3032
```
3133
Set-AzSqlDatabaseBackupLongTermRetentionPolicy [-WeeklyRetention <String>] -MonthlyRetention <String>
32-
[-ServerName] <String> [-DatabaseName] <String> [-ResourceGroupName] <String>
33-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
34+
[-TimeBasedImmutability <String>] [-TimeBasedImmutabilityMode <String>] [-ServerName] <String>
35+
[-DatabaseName] <String> [-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>]
36+
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
3437
```
3538

3639
### YearlyRetentionRequired
3740
```
3841
Set-AzSqlDatabaseBackupLongTermRetentionPolicy [-WeeklyRetention <String>] [-MonthlyRetention <String>]
39-
-YearlyRetention <String> -WeekOfYear <Int32> [-ServerName] <String> [-DatabaseName] <String>
40-
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
41-
[<CommonParameters>]
42+
-YearlyRetention <String> -WeekOfYear <Int32> [-TimeBasedImmutability <String>]
43+
[-TimeBasedImmutabilityMode <String>] [-ServerName] <String> [-DatabaseName] <String>
44+
[-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-ProgressAction <ActionPreference>]
45+
[-WhatIf] [-Confirm] [<CommonParameters>]
4246
```
4347

4448
## DESCRIPTION
@@ -61,6 +65,8 @@ MonthlyRetention : PT0S
6165
YearlyRetention : PT0S
6266
WeekOfYear : 0
6367
Location :
68+
TimeBasedImmutability : Disabled
69+
TimeBasedImmutabilityMode : Unlocked
6470
```
6571

6672
This sets the long term retention policy of database01 to save every weekly full backup for 2 weeks
@@ -79,6 +85,8 @@ MonthlyRetention : P5Y
7985
YearlyRetention : PT0S
8086
WeekOfYear : 0
8187
Location :
88+
TimeBasedImmutability : Disabled
89+
TimeBasedImmutabilityMode : Unlocked
8290
```
8391

8492
This sets the long term retention policy of database01 to save the first full backup of each month for 5 years
@@ -97,11 +105,57 @@ MonthlyRetention : PT0S
97105
YearlyRetention : P10Y
98106
WeekOfYear : 26
99107
Location :
108+
TimeBasedImmutability : Disabled
109+
TimeBasedImmutabilityMode : Unlocked
100110
```
101111

102112
This sets the long term retention policy of database01 to save the full backup taken on the 26th week of the year for 10 years
103113

104-
### Example 4: Set each retention for the current version of long term retention policy
114+
### Example 4: Set the yearly retention for the current version of long term retention policy with an unlocked time-based immutability enabled
115+
```powershell
116+
Set-AzSqlDatabaseBackupLongTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -YearlyRetention P10Y -WeekOfYear 26 -TimeBasedImmutability Enabled
117+
```
118+
119+
```output
120+
ResourceGroupName : resourcegroup01
121+
ServerName : server01
122+
DatabaseName : database01
123+
WeeklyRetention : PT0S
124+
MonthlyRetention : PT0S
125+
YearlyRetention : P10Y
126+
WeekOfYear : 26
127+
Location :
128+
TimeBasedImmutability : Enabled
129+
TimeBasedImmutabilityMode : Unlocked
130+
```
131+
132+
This sets the long term retention policy of database01 to save the full backup taken on the 26th week of the year for 10 years.
133+
Additionally, the backups will be created with an unlocked time-based immutability policy.
134+
These backups can later have their immutability locked or removed.
135+
136+
### Example 5: Set the yearly retention for the current version of long term retention policy with a locked time-based immutability enabled
137+
```powershell
138+
Set-AzSqlDatabaseBackupLongTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -YearlyRetention P10Y -WeekOfYear 26 -TimeBasedImmutability Enabled -TimeBasedImmutabilityMode Locked
139+
```
140+
141+
```output
142+
ResourceGroupName : resourcegroup01
143+
ServerName : server01
144+
DatabaseName : database01
145+
WeeklyRetention : PT0S
146+
MonthlyRetention : PT0S
147+
YearlyRetention : P10Y
148+
WeekOfYear : 26
149+
Location :
150+
TimeBasedImmutability : Enabled
151+
TimeBasedImmutabilityMode : Locked
152+
```
153+
154+
This sets the long term retention policy of database01 to save the full backup taken on the 26th week of the year for 10 years.
155+
Additionally, the backups will be created with a locked time-based immutability policy.
156+
These backups can not be deleted manually and will only be dropped on expiration.
157+
158+
### Example 6: Set each retention for the current version of long term retention policy
105159
```powershell
106160
Set-AzSqlDatabaseBackupLongTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -WeeklyRetention 14 -MonthlyRetention P24W -YearlyRetention P10Y -WeekOfYear 26
107161
```
@@ -115,11 +169,13 @@ MonthlyRetention : P24W
115169
YearlyRetention : P10Y
116170
WeekOfYear : 26
117171
Location :
172+
TimeBasedImmutability : Disabled
173+
TimeBasedImmutabilityMode : Unlocked
118174
```
119175

120176
This sets the long term retention policy of database01 to save each full backup for 14 days, the first full backup of each month for 24 weeks, and the full backup taken on the 26th week of the year for 10 years
121177

122-
### Example 5: Remove the long term retention policy
178+
### Example 7: Remove the long term retention policy
123179
```powershell
124180
Set-AzSqlDatabaseBackupLongTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -RemovePolicy
125181
```
@@ -133,12 +189,14 @@ MonthlyRetention : PT0S
133189
YearlyRetention : PT0S
134190
WeekOfYear : 0
135191
Location :
192+
TimeBasedImmutability : Disabled
193+
TimeBasedImmutabilityMode : Unlocked
136194
```
137195

138196
Removes the policy for database01 so it no longer saves any long term retention backups.
139-
This will not affect backups that have already been taken
197+
This will not affect backups that have already been taken.
140198

141-
### Example 6: Remove the long term retention policy
199+
### Example 8: Remove the long term retention policy
142200
```powershell
143201
Set-AzSqlDatabaseBackupLongTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -WeeklyRetention P0D
144202
```
@@ -152,6 +210,8 @@ MonthlyRetention : PT0S
152210
YearlyRetention : PT0S
153211
WeekOfYear : 0
154212
Location :
213+
TimeBasedImmutability : Disabled
214+
TimeBasedImmutabilityMode : Unlocked
155215
```
156216

157217
This is another way of removing the policy for database01 so it no longer saves any long term retention backups.
@@ -218,8 +278,23 @@ Accept pipeline input: True (ByPropertyName)
218278
Accept wildcard characters: False
219279
```
220280
281+
### -ProgressAction
282+
{{ Fill ProgressAction Description }}
283+
284+
```yaml
285+
Type: System.Management.Automation.ActionPreference
286+
Parameter Sets: (All)
287+
Aliases: proga
288+
289+
Required: False
290+
Position: Named
291+
Default value: None
292+
Accept pipeline input: False
293+
Accept wildcard characters: False
294+
```
295+
221296
### -RemovePolicy
222-
If provided, the policy for the database will be removed.
297+
If provided, the policy for the database will be cleared.
223298
224299
```yaml
225300
Type: System.Management.Automation.SwitchParameter
@@ -263,6 +338,41 @@ Accept pipeline input: True (ByPropertyName)
263338
Accept wildcard characters: False
264339
```
265340
341+
### -TimeBasedImmutability
342+
When set, future backups will have TimeBasedImmutability enabled.
343+
344+
```yaml
345+
Type: System.String
346+
Parameter Sets: (All)
347+
Aliases:
348+
Accepted values: Enabled, Disabled
349+
350+
Required: False
351+
Position: Named
352+
Default value: None
353+
Accept pipeline input: True (ByPropertyName)
354+
Accept wildcard characters: False
355+
```
356+
357+
### -TimeBasedImmutabilityMode
358+
The setting for time-based immutability mode for future backups.
359+
Only effective if TimeBasedImmutability is enabled.
360+
Value can be either Locked or Unlocked.
361+
Caution: Immutability of LTR backup cannot be removed if TimeBasedImmutabilityMode is Locked.
362+
363+
```yaml
364+
Type: System.String
365+
Parameter Sets: (All)
366+
Aliases:
367+
Accepted values: Unlocked, Locked
368+
369+
Required: False
370+
Position: Named
371+
Default value: None
372+
Accept pipeline input: True (ByPropertyName)
373+
Accept wildcard characters: False
374+
```
375+
266376
### -WeeklyRetention
267377
The Weekly Retention.
268378
If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.
@@ -334,7 +444,7 @@ Aliases: cf
334444

335445
Required: False
336446
Position: Named
337-
Default value: False
447+
Default value: None
338448
Accept pipeline input: False
339449
Accept wildcard characters: False
340450
```
@@ -350,7 +460,7 @@ Aliases: wi
350460

351461
Required: False
352462
Position: Named
353-
Default value: False
463+
Default value: None
354464
Accept pipeline input: False
355465
Accept wildcard characters: False
356466
```
@@ -373,13 +483,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
373483
## RELATED LINKS
374484
375485
[Get-AzSqlDatabaseLongTermRetentionBackup](./Get-AzSqlDatabaseLongTermRetentionBackup.md)
376-
377486
[Update-AzSqlDatabaseLongTermRetentionBackup](./Update-AzSqlDatabaseLongTermRetentionBackup.md)
378-
379487
[Copy-AzSqlDatabaseLongTermRetentionBackup](./Copy-AzSqlDatabaseLongTermRetentionBackup.md)
380-
381488
[Remove-AzSqlDatabaseLongTermRetentionBackup](./Remove-AzSqlDatabaseLongTermRetentionBackup.md)
382-
383489
[Get-AzSqlDatabaseBackupLongTermRetentionPolicy](./Get-AzSqlDatabaseBackupLongTermRetentionPolicy.md)
384-
385490
[SQL Database Documentation](https://learn.microsoft.com/azure/sql-database/)

0 commit comments

Comments
 (0)