Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy
Gets a database long term retention policy.
Important
Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we'll retire AzureRM PowerShell modules on 29 February 2024.
To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024. To automatically update your scripts, follow the quickstart guide.
Syntax
Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy
[-Current]
[-ServerName] <String>
[-DatabaseName] <String>
[-ResourceGroupName] <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy cmdlet gets the long term retention policy registered to this database. The policy is an Azure Backup resource used to define backup storage policy.
Examples
Example 1: Get the current version of the long term retention policy
PS C:\> Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01 -Current
ResourceGroupName : resourcegroup01
ServerName : server01
DatabaseName : database01
WeeklyRetention : P2W
MonthlyRetention : PT0S
YearlyRetention : PT0S
WeekOfYear : 0
State :
RecoveryServicesBackupPolicyResourceId :
Location :
This command gets the current version of the long term retention policy for database01
Example 2: Get the legacy version of the long term retention policy
PS C:\> Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy -ResourceGroupName resourcegroup01 -ServerName server01 -DatabaseName database01
ResourceGroupName : resourcegroup01
ServerName : server01
DatabaseName : database01
WeeklyRetention :
MonthlyRetention :
YearlyRetention :
WeekOfYear :
State : Enabled
RecoveryServicesBackupPolicyResourceId : /subscriptions/4f2b42fc-4fc3-fd41-8ab8-5a382d8b30df/resourceGroups/resourcegroup01/providers/MicrosoftRecoveryServices/vaults/vault01/backupPolicies/policy01
Location : Southeast Asia
This command gets the legacy version of the long term retention policy for database01
Parameters
Prompts you for confirmation before running the cmdlet.
| Type: | SwitchParameter |
| Aliases: | cf |
| Position: | Named |
| Default value: | False |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
If not provided, the command returns the legacy Long Term Retention policy information. Otherwise, the command returns the current version of the Long Term Retention policy.
| Type: | SwitchParameter |
| Position: | Named |
| Default value: | False |
| 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: | AzureRmContext, AzureCredential |
| 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 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: | False |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Inputs
Outputs
AzureSqlDatabaseBackupLongTermRetentionPolicyModel