New-​Azure​Rm​Backup​Protection​Policy

Creates a Backup policy.

Syntax

New-AzureRmBackupProtectionPolicy
   [-Vault] <AzureRMBackupVault>
   [-Name] <String>
   [-Type] <String>
   [-Daily]
   [-BackupTime] <DateTime>
   [-RetentionPolicy] <AzureRMBackupRetentionPolicy[]>
   [<CommonParameters>]
New-AzureRmBackupProtectionPolicy
   [-Vault] <AzureRMBackupVault>
   [-Name] <String>
   [-Type] <String>
   [-BackupTime] <DateTime>
   [[-DaysOfWeek] <String[]>]
   [-RetentionPolicy] <AzureRMBackupRetentionPolicy[]>
   [<CommonParameters>]
New-AzureRmBackupProtectionPolicy
   [-Vault] <AzureRMBackupVault>
   [-Name] <String>
   [-Type] <String>
   [-Weekly]
   [-BackupTime] <DateTime>
   [-DaysOfWeek] <String[]>
   [-RetentionPolicy] <AzureRMBackupRetentionPolicy[]>
   [<CommonParameters>]

Description

The New-AzureRmBackupProtectionPolicy cmdlet creates an Azure Backup policy as an Azure PowerShell object.

A backup policy defines when and how often Backup backs up an item. The Enable-AzureRmBackupProtection cmdlet uses a backup policy.

Examples

Example 1: Create a daily backup policy with daily and monthly retention

PS C:\>$Vault = Get-AzureRmBackupVault -Name "Vault03"
PS C:\> $Daily = New-AzureRmBackupRetentionPolicyObject -DailyRetention -Retention 30
PS C:\> $Monthly = New-AzureRmBackupRetentionPolicyObject -MonthlyRetentionInDailyFormat -DaysOfMonth (10, 20) -Retention 12
PS C:\> $ProtectionPolicy = New-AzureRmBackupProtectionPolicy -Name DailyBackup01 -Type AzureVM -Daily -BackupTime ([datetime]"3:30 PM") -RetentionPolicy ($Daily,$Monthly) -Vault $Vault
Name                      Type               ScheduleType       BackupTime
----                      ----               ------------       ----------
DailyBkp                  AzureVM            Daily              26-Aug-15 3:00:00 PM

The first command gets the vault named Vault03 by using the Get-AzureRmBackupVault cmdlet. The command stores that object in the $Vault variable.

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

The third 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 final command creates a backup policy for the vault in $Vault that has a daily backup time of 3:00 PM. The command assigns the retention policies stored in $Daily and $Monthly. The command stores the result in the $ProtectionPolicy variable.

Required Parameters

-BackupTime

Specifies the time of day, as a DateTime object, for the backup operation. To obtain a DateTime, use the Get-Date cmdlet. For information about DateTime objects, type Get-Help Get-Date.

Type:DateTime
Position:6
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Name

Specifies a name for the backup policy. Select a name that is unique in the vault.

Type:String
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RetentionPolicy

Specifies an array of retention policies for the backup policy. To obtain an AzureRmBackupRetentionPolicy, use the New-AzureRmBackupRetentionPolicyObject cmdlet.

Type:AzureRMBackupRetentionPolicy[]
Position:8
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Type

Specifies the type of backup item to which the policy applies. Currently, the only supported value is AzureVM.

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Vault

Specifies the Azure Backup vault to which the backup policy belongs. To obtain an AzureRmBackupVault object, use the Get-AzureRmBackupVault cmdlet.

Type:AzureRMBackupVault
Position:1
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Weekly

Indicates that the backup policy is triggered weekly on one or more days of the week.

Type:SwitchParameter
Position:5
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-Daily

Indicates that the backup operation runs on a Daily schedule.

Type:SwitchParameter
Position:4
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DaysOfWeek

Specifies an array of days of the week. This policy runs backups on the days specified by this parameter. The acceptable values for this parameter are:- Monday

  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday

    If you specify the Weekly parameter, specify this parameter.
Type:String[]
Parameter Sets:Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
Position:7
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Inputs

None

Outputs

AzureRmBackupProtectionPolicy

Notes

  • None