< Back

Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy

Tue Jan 29, 2019 10:08 pm

NAME Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy



SYNOPSIS

Gets a database long term retention policy.





SYNTAX

Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy [-ResourceGroupName] <String> [-ServerName] <String> [-DatabaseName] <String> [-Current]

[-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<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.





PARAMETERS

-Current [<SwitchParameter>]

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.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-DatabaseName <String>

The name of the Azure SQL Database to use.



Required? true

Position? 2

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with Azure.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ResourceGroupName <String>

The name of the resource group.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ServerName <String>

The name of the Azure SQL Server the database is in.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.Sql.Backup.Model.AzureSqlDatabaseBackupLongTermRetentionPolicyModel







NOTES









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/MicrosoftReco

veryServices/vaults/vault01/backupPolicies/policy01

Location : Southeast Asia



This command gets the legacy version of the long term retention policy for database01







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... tionpolicy

Get-AzureRmSqlDatabaseLongTermRetentionBackup

Remove-AzureRmSqlDatabaseLongTermRetentionBackup

Set-AzureRmSqlDatabaseBackupLongTermRetentionPolicy

SQL Database Documentation https://docs.microsoft.com/azure/sql-database/