Get-AzureRmRecoveryServicesBackupSchedulePolicyObject
Gets a base schedule policy object.
Caution
Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we'll retire AzureRM PowerShell modules on 29 February 2024.
To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024. To automatically update your scripts, follow the quickstart guide.
Syntax
Get-AzureRmRecoveryServicesBackupSchedulePolicyObject
[-WorkloadType] <WorkloadType>
[[-BackupManagementType] <BackupManagementType>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
The Get-AzureRmRecoveryServicesBackupSchedulePolicyObject cmdlet gets a base AzureRMRecoveryServicesSchedulePolicyObject. This object is not persisted in the system. It is temporary object that you can manipulate and use with the New-AzureRmRecoveryServicesBackupProtectionPolicy cmdlet to create a new backup protection policy.
Examples
Example 1: Set the schedule frequency to weekly
PS C:\>$RetPol = Get-AzureRmRecoveryServicesBackupRetentionPolicyObject -WorkloadType "AzureVM"
PS C:\> $SchPol = Get-AzureRmRecoveryServicesBackupSchedulePolicyObject -WorkloadType "AzureVM"
PS C:\> $SchPol.ScheduleRunFrequency = "Weekly"
PS C:\> New-AzureRmRecoveryServicesBackupProtectionPolicy -Name "NewPolicy" -WorkloadType AzureVM -RetentionPolicy $RetPol -SchedulePolicy $SchPol
The first command gets the retention policy object, and then stores it in the $RetPol variable. The second command gets the schedule policy object, and then stores it in the $SchPol variable. The third command changes the frequency for the schedule policy to weekly. The last command creates a backup protection policy with the updated schedule.
Example 2: Set the backup time
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:\> New-AzureRmRecoveryServicesBackupProtectionPolicy -Name "NewPolicy" -WorkloadType AzureVM -RetentionPolicy $RetPol -SchedulePolicy $SchPol
The first command gets the schedule policy object, and then stores it in the $SchPol variable. The second command removes all scheduled run times from $SchPol. The third command gets the current date and time, and then stores it in the $DT variable. The fourth command replaces the scheduled run times with the current time. You can only backup AzureVM once per day, so to reset the backup time you must replace the original schedule. The last command creates a backup protection policy using the new schedule.
Parameters
-BackupManagementType
Specifies the Backup management type. The acceptable values for this parameter are:
- AzureVM
- AzureSQLDatabase
- AzureStorage
Type: | Nullable<T>[BackupManagementType] |
Accepted values: | AzureVM, MARS, SCDPM, AzureBackupServer, AzureSQL, AzureStorage |
Position: | 1 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WorkloadType
Specifies the workload type. The acceptable values for this parameter are:
- AzureVM
- AzureSQLDatabase
- AzureFiles
Type: | WorkloadType |
Accepted values: | AzureVM, AzureSQLDatabase, AzureFiles |
Position: | 0 |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
None