< Back
New-AzureRmBackupProtectionPolicy
Post
NAME New-AzureRmBackupProtectionPolicy
SYNOPSIS
Creates a Backup policy.
SYNTAX
New-AzureRmBackupProtectionPolicy [-Vault] <AzureRMBackupVault> [-Name] <String> [-Type] {AzureVM} [[-Daily]] [-BackupTime] <DateTime>
[-RetentionPolicy] <AzureRMBackupRetentionPolicy[]> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
New-AzureRmBackupProtectionPolicy [-Vault] <AzureRMBackupVault> [-Name] <String> [-Type] {AzureVM} [-BackupTime] <DateTime> [[-DaysOfWeek] {Monday
| Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday}]
[-RetentionPolicy] <AzureRMBackupRetentionPolicy[]> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
New-AzureRmBackupProtectionPolicy [-Vault] <AzureRMBackupVault> [-Name] <String> [-Type] {AzureVM} [-Weekly] [-BackupTime] <DateTime>
[-DaysOfWeek] {Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday
| Sunday} [-RetentionPolicy] <AzureRMBackupRetentionPolicy[]> [-DefaultProfile <IAzureContextContainer>] [<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.
PARAMETERS
-BackupTime <DateTime>
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`.
Required? true
Position? 5
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Daily [<SwitchParameter>]
Indicates that the backup operation runs on a Daily schedule.
Required? false
Position? 3
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DaysOfWeek <String[]>
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.
Required? false
Position? 6
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
-Name <String>
Specifies a name for the backup policy. Select a name that is unique in the vault.
Required? true
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-RetentionPolicy <AzureRMBackupRetentionPolicy[]>
Specifies an array of retention policies for the backup policy. To obtain an AzureRmBackupRetentionPolicy , use the
New-AzureRmBackupRetentionPolicyObject cmdlet.
Required? true
Position? 7
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Type <String>
Specifies the type of backup item to which the policy applies. Currently, the only supported value is AzureVM.
Required? true
Position? 2
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Vault <AzureRMBackupVault>
Specifies the Azure Backup vault to which the backup policy belongs. To obtain an AzureRmBackupVault object, use the Get-AzureRmBackupVault
cmdlet.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-Weekly [<SwitchParameter>]
Indicates that the backup policy is triggered weekly on one or more days of the week.
Required? true
Position? 4
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
AzureRmBackupProtectionPolicy
NOTES
* None
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.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... tionpolicy
Enable-AzureRmBackupProtection
Get-AzureRmBackupProtectionPolicy
Get-AzureRmBackupVault
New-AzureRmBackupRetentionPolicyObject
Remove-AzureRmBackupProtectionPolicy
Set-AzureRmBackupProtectionPolicy
SYNOPSIS
Creates a Backup policy.
SYNTAX
New-AzureRmBackupProtectionPolicy [-Vault] <AzureRMBackupVault> [-Name] <String> [-Type] {AzureVM} [[-Daily]] [-BackupTime] <DateTime>
[-RetentionPolicy] <AzureRMBackupRetentionPolicy[]> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
New-AzureRmBackupProtectionPolicy [-Vault] <AzureRMBackupVault> [-Name] <String> [-Type] {AzureVM} [-BackupTime] <DateTime> [[-DaysOfWeek] {Monday
| Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday}]
[-RetentionPolicy] <AzureRMBackupRetentionPolicy[]> [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
New-AzureRmBackupProtectionPolicy [-Vault] <AzureRMBackupVault> [-Name] <String> [-Type] {AzureVM} [-Weekly] [-BackupTime] <DateTime>
[-DaysOfWeek] {Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday
| Sunday} [-RetentionPolicy] <AzureRMBackupRetentionPolicy[]> [-DefaultProfile <IAzureContextContainer>] [<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.
PARAMETERS
-BackupTime <DateTime>
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`.
Required? true
Position? 5
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Daily [<SwitchParameter>]
Indicates that the backup operation runs on a Daily schedule.
Required? false
Position? 3
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DaysOfWeek <String[]>
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.
Required? false
Position? 6
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
-Name <String>
Specifies a name for the backup policy. Select a name that is unique in the vault.
Required? true
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-RetentionPolicy <AzureRMBackupRetentionPolicy[]>
Specifies an array of retention policies for the backup policy. To obtain an AzureRmBackupRetentionPolicy , use the
New-AzureRmBackupRetentionPolicyObject cmdlet.
Required? true
Position? 7
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Type <String>
Specifies the type of backup item to which the policy applies. Currently, the only supported value is AzureVM.
Required? true
Position? 2
Default value None
Accept pipeline input? True (ByPropertyName)
Accept wildcard characters? false
-Vault <AzureRMBackupVault>
Specifies the Azure Backup vault to which the backup policy belongs. To obtain an AzureRmBackupVault object, use the Get-AzureRmBackupVault
cmdlet.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-Weekly [<SwitchParameter>]
Indicates that the backup policy is triggered weekly on one or more days of the week.
Required? true
Position? 4
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
AzureRmBackupProtectionPolicy
NOTES
* None
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.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... tionpolicy
Enable-AzureRmBackupProtection
Get-AzureRmBackupProtectionPolicy
Get-AzureRmBackupVault
New-AzureRmBackupRetentionPolicyObject
Remove-AzureRmBackupProtectionPolicy
Set-AzureRmBackupProtectionPolicy