< Back
Set-AzureRmRecoveryServicesBackupProtectionPolicy
Post
NAME Set-AzureRmRecoveryServicesBackupProtectionPolicy
SYNOPSIS
Modifies a Backup protection policy.
SYNTAX
Set-AzureRmRecoveryServicesBackupProtectionPolicy [-Policy] <PolicyBase> [[-RetentionPolicy] <RetentionPolicyBase>] [[-SchedulePolicy]
<SchedulePolicyBase>] [-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Set-AzureRmBackupProtectionPolicy cmdlet modifies an existing Azure Backup protection policy. You can modify the Backup schedule and retention
policy components.
Any changes you make affect the backup and retention of the items associated with the policy.
Set the vault context by using the Set-AzureRmRecoveryServicesVaultContext cmdlet before you use the current cmdlet.
PARAMETERS
-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
-Policy <PolicyBase>
Specifies the Backup protection policy that this cmdlet modifies. To obtain a BackupProtectionPolicy object, use the
Get-AzureRmRecoveryServicesBackupProtectionPolicy cmdlet.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-RetentionPolicy <RetentionPolicyBase>
Specifies the base retention policy. To obtain a RetentionPolicy object, use the Get-AzureRmRecoveryServicesBackupRetentionPolicyObject cmdlet.
Required? false
Position? 2
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SchedulePolicy <SchedulePolicyBase>
Specifies the base schedule policy object. To obtain a SchedulePolicy object, use the Get-AzureRmRecoveryServicesBackupSchedulePolicyObject
object.
Required? false
Position? 3
Default value None
Accept pipeline input? False
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
PolicyBase
Parameter 'Policy' accepts value of type 'PolicyBase' from the pipeline
OUTPUTS
System.Collections.Generic.List`1[Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.JobBase]
NOTES
Example 1: Modify a Backup protection policy
PS C:\\>$SchPol = Get-AzureRmRecoveryServicesBackupSchedulePolicyObject -WorkloadType "AzureVM"
PS C:\\> $SchPol.ScheduleRunTimes.RemoveAll()
PS C:\\> $DT = Get-Date
PS C:\\> $SchPol.ScheduleRunTimes.Add($DT.ToUniversalTime())
PS C:\\> $RetPol = Get-AzureRmRecoveryServicesBackupRetentionPolicyObject -WorkloadType "AzureVM"
PS C:\\> $RetPol.DailySchedule.DurationCountInDays = 365
PS C:\\> $Pol = Get-AzureRmRecoveryServicesBackupProtectionPolicy -Name "NewPolicy"
PS C:\\> Set-AzureRmRecoveryServicesBackupProtectionPolicy -Policy $Pol -SchedulePolicy $SchPol -RetentionPolicy $RetPol
The first command gets a base SchedulePolicy object, and then stores it in the $SchPol variable.
The second command removes all scheduled run times from the schedule policy in $SchPol.
The third command uses the Get-Date cmdlet to get the current date and time, and then stores it in the $DT variable.
The fourth command adds the date and time in $DT to the schedule run time for the schedule policy.
The fifth command gets a base retention policy object, and then stores it in the $RetPol variable.
The sixth command sets the retention duration to 365 days.
The seventh command gets the Backup protection policy named NewPolicy, and then stores it in the $Pol variable.
The final command modifies the Backup protection policy in $Pol using schedule policy in $SchPol and the retention policy in $RetPol.
RELATED LINKS
Online Version:
https://docs.microsoft.com/en-us/powers ... tionpolicy
Get-AzureRmRecoveryServicesBackupProtectionPolicy
Get-AzureRmRecoveryServicesBackupRetentionPolicyObject
New-AzureRmRecoveryServicesBackupProtectionPolicy
Remove-AzureRmRecoveryServicesBackupProtectionPolicy
SYNOPSIS
Modifies a Backup protection policy.
SYNTAX
Set-AzureRmRecoveryServicesBackupProtectionPolicy [-Policy] <PolicyBase> [[-RetentionPolicy] <RetentionPolicyBase>] [[-SchedulePolicy]
<SchedulePolicyBase>] [-DefaultProfile <IAzureContextContainer>] [-Confirm] [-WhatIf] [<CommonParameters>]
DESCRIPTION
The Set-AzureRmBackupProtectionPolicy cmdlet modifies an existing Azure Backup protection policy. You can modify the Backup schedule and retention
policy components.
Any changes you make affect the backup and retention of the items associated with the policy.
Set the vault context by using the Set-AzureRmRecoveryServicesVaultContext cmdlet before you use the current cmdlet.
PARAMETERS
-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
-Policy <PolicyBase>
Specifies the Backup protection policy that this cmdlet modifies. To obtain a BackupProtectionPolicy object, use the
Get-AzureRmRecoveryServicesBackupProtectionPolicy cmdlet.
Required? true
Position? 1
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-RetentionPolicy <RetentionPolicyBase>
Specifies the base retention policy. To obtain a RetentionPolicy object, use the Get-AzureRmRecoveryServicesBackupRetentionPolicyObject cmdlet.
Required? false
Position? 2
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SchedulePolicy <SchedulePolicyBase>
Specifies the base schedule policy object. To obtain a SchedulePolicy object, use the Get-AzureRmRecoveryServicesBackupSchedulePolicyObject
object.
Required? false
Position? 3
Default value None
Accept pipeline input? False
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
PolicyBase
Parameter 'Policy' accepts value of type 'PolicyBase' from the pipeline
OUTPUTS
System.Collections.Generic.List`1[Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.JobBase]
NOTES
Example 1: Modify a Backup protection policy
PS C:\\>$SchPol = Get-AzureRmRecoveryServicesBackupSchedulePolicyObject -WorkloadType "AzureVM"
PS C:\\> $SchPol.ScheduleRunTimes.RemoveAll()
PS C:\\> $DT = Get-Date
PS C:\\> $SchPol.ScheduleRunTimes.Add($DT.ToUniversalTime())
PS C:\\> $RetPol = Get-AzureRmRecoveryServicesBackupRetentionPolicyObject -WorkloadType "AzureVM"
PS C:\\> $RetPol.DailySchedule.DurationCountInDays = 365
PS C:\\> $Pol = Get-AzureRmRecoveryServicesBackupProtectionPolicy -Name "NewPolicy"
PS C:\\> Set-AzureRmRecoveryServicesBackupProtectionPolicy -Policy $Pol -SchedulePolicy $SchPol -RetentionPolicy $RetPol
The first command gets a base SchedulePolicy object, and then stores it in the $SchPol variable.
The second command removes all scheduled run times from the schedule policy in $SchPol.
The third command uses the Get-Date cmdlet to get the current date and time, and then stores it in the $DT variable.
The fourth command adds the date and time in $DT to the schedule run time for the schedule policy.
The fifth command gets a base retention policy object, and then stores it in the $RetPol variable.
The sixth command sets the retention duration to 365 days.
The seventh command gets the Backup protection policy named NewPolicy, and then stores it in the $Pol variable.
The final command modifies the Backup protection policy in $Pol using schedule policy in $SchPol and the retention policy in $RetPol.
RELATED LINKS
Online Version:
https://docs.microsoft.com/en-us/powers ... tionpolicy
Get-AzureRmRecoveryServicesBackupProtectionPolicy
Get-AzureRmRecoveryServicesBackupRetentionPolicyObject
New-AzureRmRecoveryServicesBackupProtectionPolicy
Remove-AzureRmRecoveryServicesBackupProtectionPolicy