Set-AzSqlDatabaseBackupShortTermRetentionPolicy
Sets a backup short term retention policy.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
Syntax
Set-AzSqlDatabaseBackupShortTermRetentionPolicy
[-RetentionDays <Int32>]
[-DiffBackupIntervalInHours <Int32>]
[-ResourceGroupName] <String>
[-ServerName] <String>
[-DatabaseName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzSqlDatabaseBackupShortTermRetentionPolicy
[-RetentionDays <Int32>]
[-DiffBackupIntervalInHours <Int32>]
-AzureSqlDatabaseObject <AzureSqlDatabaseModel>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzSqlDatabaseBackupShortTermRetentionPolicy
[-RetentionDays <Int32>]
[-DiffBackupIntervalInHours <Int32>]
-ResourceId <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Set-AzSqlDatabaseBackupShortTermRetentionPolicy cmdlet sets the short term retention policy for this database. The policy is the retention period, in days, for point-in-time restore backups and differential backup frequency, in hours.
Examples
Example 1
PS C:\> Set-AzSqlDatabaseBackupShortTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -RetentionDays 6 -DiffBackupIntervalInHours 24
ResourceGroupName ServerName DatabaseName RetentionDays DiffBackupIntervalInHours
----------------- ---------- ------------ ------------- -------------------------
resourcegroup01 server01 database01 6 24
This command sets the short term retention policy for database01 to 6 retention days and 24 differential backup interval hours.
Example 2
PS C:\> Get-AzSqlDatabase -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 | Set-AzSqlDatabaseBackupShortTermRetentionPolicy -RetentionDays 5 -DiffBackupIntervalInHours 12
ResourceGroupName ServerName DatabaseName RetentionDays DiffBackupIntervalInHours
----------------- ---------- ------------ ------------- ------------------------
resourcegroup01 server01 database01 5 12
This command sets the short term retention policy for database01 to 5 retention days and 12 differential backup interval hours via piping in a database object.
Example 3
PS C:\> Set-AzSqlDatabaseBackupShortTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -RetentionDays 7
ResourceGroupName ServerName DatabaseName RetentionDays DiffBackupIntervalInHours
----------------- ---------- ------------ ------------- -------------------------
resourcegroup01 server01 database01 7 12
This command sets the short term retention policy for database01 to 7 retention days only. DiffBackupIntervalInHours is unchanged.
Parameters
The database object to get the policy for.
| Type: | AzureSqlDatabaseModel |
| Aliases: | AzureSqlDatabase |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
| Type: | SwitchParameter |
| Aliases: | cf |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The name of the Azure SQL Database to use.
| Type: | String |
| Position: | 2 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Differential backup frequency in hours.
| Type: | Int32 |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The name of the resource group.
| Type: | String |
| Position: | 0 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The short term retention policy resource Id.
| Type: | String |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
The backup retention setting, in days.
| Type: | Int32 |
| Position: | Named |
| Default value: | 7 |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The name of the Azure SQL Server the database is in.
| Type: | String |
| Position: | 1 |
| Default value: | None |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
| Type: | SwitchParameter |
| Aliases: | wi |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |