< Back

New-AzureRmBackupRetentionPolicyObject

Tue Jan 29, 2019 9:34 pm

NAME New-AzureRmBackupRetentionPolicyObject



SYNOPSIS

Creates a Backup retention policy.





SYNTAX

New-AzureRmBackupRetentionPolicyObject [-DailyRetention] [-DefaultProfile <IAzureContextContainer>] -Retention <Int32> [<CommonParameters>]



New-AzureRmBackupRetentionPolicyObject -DaysOfMonth {1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21

| 22 | 23 | 24 | 25 | 26 | 27 | 28 | Last} [-DefaultProfile <IAzureContextContainer>] [-MonthlyRetentionInDailyFormat] -Retention <Int32>

[<CommonParameters>]



New-AzureRmBackupRetentionPolicyObject -DaysOfMonth {1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21

| 22 | 23 | 24 | 25 | 26 | 27 | 28 | Last} [-DefaultProfile <IAzureContextContainer>] -MonthsOfYear {January | February | March | April | May |

June | July | August | September | October | November | December} -Retention <Int32> [-YearlyRetentionInDailyFormat] [<CommonParameters>]



New-AzureRmBackupRetentionPolicyObject -DaysOfWeek {Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday} [-DefaultProfile

<IAzureContextContainer>] -Retention <Int32> [-WeeklyRetention] [<CommonParameters>]



New-AzureRmBackupRetentionPolicyObject -DaysOfWeek {Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday} [-DefaultProfile

<IAzureContextContainer>] [-MonthlyRetentionInWeeklyFormat] -Retention <Int32> -WeekNumber {First | Second | Third | Fourth | Last}

[<CommonParameters>]



New-AzureRmBackupRetentionPolicyObject -DaysOfWeek {Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday} [-DefaultProfile

<IAzureContextContainer>] -MonthsOfYear {January | February | March | April | May | June | July | August | September | October | November |

December} -Retention <Int32> -WeekNumber {First | Second | Third | Fourth | Last} [-YearlyRetentionInWeeklyFormat] [<CommonParameters>]





DESCRIPTION

The New-AzureRmBackupRetentionPolicyObject cmdlet creates an Azure Backup retention policy. A retention policy defines how long Backup keeps a

recovery point. The types of retention are the following:



- Daily



- Weekly



- Monthly



- Yearly





Create one retention policy for each type of retention that you plan to use.

A backup policy is associated with at least one retention policy. To create a backup policy, use the New-AzureRmBackupProtectionPolicy cmdlet. You

can instead provide a retention policy to the Enable-AzureRmBackupProtection cmdlet.







PARAMETERS

-DailyRetention [<SwitchParameter>]

Indicates that this cmdlet creates a Daily retention policy.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-DaysOfMonth <System.Collections.Generic.List`1[System.String]>

Specifies the days of the month that identify which recovery points Backup retains and for how long. The acceptable values for this parameter

are: integers from 1 through 28 and Last. Specify this parameter if you specify the DailyRetention , MonthlyRetentionInDailyFormat , and

YearlyRetentionInDailyFormat parameters.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DaysOfWeek <String[]>

Specifies an array of days of the week. The days that this cmdlet specifies identify which recovery points that Backup retains and for how

long. The acceptable values for this parameter are:



- Monday



- Tuesday



- Wednesday



- Thursday



- Friday



- Saturday



- Sunday





Specify this parameter if you specify the WeeklyRetention , MonthlyRetentionInWeeklyFormat , and YearlyRetentionInWeeklyFormat parameters.

Be sure that the days of the week you select for backup and for retention are aligned. For example, if your backup is set for Saturdays, the

retention policies must also use Saturday.





Required? true

Position? named

Default value None

Accept pipeline input? False

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



-MonthlyRetentionInDailyFormat [<SwitchParameter>]

Indicates that this cmdlet creates a Monthly policy in Daily format.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-MonthlyRetentionInWeeklyFormat [<SwitchParameter>]

Indicates that this cmdlet creates a Monthly policy in Weekly format.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-MonthsOfYear <String[]>

Specifies which months of the year have the recovery points that Backup retains on a yearly basis. The acceptable values for this parameter

are: names of months, such as January or February.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Retention <Int32>

Specifies the retention period, in days, months, or years, for which Backup stores a backup point. The unit depends on whether this cmdlet

selects a daily, monthly, or yearly retention option. For example, if specify the DailyRetention parameter, the cmdlet interprets the current

parameter as a number of days.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-WeeklyRetention [<SwitchParameter>]

Indicates that this cmdlet creates a Weekly retention policy.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WeekNumber <String[]>

Specifies the weeks of the month that identify which recovery points Backup retains and for how long. The acceptable values for this parameter

are:



- First



- Second



- Third



- Fourth



- Last



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-YearlyRetentionInDailyFormat [<SwitchParameter>]

Indicates that this cmdlet creates a Yearly retention policy in Daily format.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-YearlyRetentionInWeeklyFormat [<SwitchParameter>]

Indicates that this cmdlet creates a Yearly retention policy in Weekly format.



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







OUTPUTS

AzureRmBackupRetentionPolicy







NOTES





* None



Example 1: Create a retention policy for daily retention



PS C:\\>$Daily = New-AzureRmBackupRetentionPolicyObject -DailyRetention -Retention 30

PS C:\\> $Daily

RetentionType Retention RetentionTimes

------------- --------- --------------

Daily 30



The first command creates a retention policy for 30 days of daily retention, and then stores it in the $Daily variable.



The second command displays the contents of $Daily.





Example 2: Create a monthly retention policy



PS C:\\>$Monthly = New-AzureRmBackupRetentionPolicyObject -MonthlyRetentionInDailyFormat -DaysOfMonth (10, 20) -Retention 12

PS C:\\> $Monthly | select *

RetentionFormat : Daily

DaysOfMonth : {10, 20}

WeekNumber :

DaysOfWeek :

RetentionType : Monthly

Retention : 12

RetentionTimes :



The first command creates a retention policy that keeps the backup on the tenth and the twentieth of each month for twelve months. The command

stores the retention policy in the $Monthly variable.



The second command displays the contents of $Monthly.







RELATED LINKS

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

Enable-AzureRmBackupProtection

New-AzureRmBackupProtectionPolicy