Get-AzRecoveryServicesBackupRetentionPolicyObject
Gets a base retention policy object.
Syntax
Default (Default)
Get-AzRecoveryServicesBackupRetentionPolicyObject
[-WorkloadType] <WorkloadType>
[[-BackupManagementType] <BackupManagementType>]
[[-BackupTier] <BackupTierType>]
[-DefaultProfile <IAzureContextContainer>]
[[-ScheduleRunFrequency] <ScheduleRunType>]
[<CommonParameters>]
Description
The Get-AzRecoveryServicesBackupRetentionPolicyObject cmdlet gets a base AzureRMRecoveryServicesRetentionPolicyObject. This object is not persisted in the system. It is a temporary object that you can manipulate and use with the New-AzRecoveryServicesBackupProtectionPolicy cmdlet to create a new backup policy.
Examples
Example 1: Create a backup protection policy
$RetPol = Get-AzRecoveryServicesBackupRetentionPolicyObject -WorkloadType AzureVM
$RetPol.DailySchedule.DurationCountInDays = 365
$SchPol = Get-AzRecoveryServicesBackupSchedulePolicyObject -WorkloadType AzureVM
New-AzRecoveryServicesBackupProtectionPolicy -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 sets the duration for the retention policy object to 365 days. The third command gets the schedule policy object, and then stores it in the $SchPol variable. The last command creates a backup protection policy using the retention policy and schedule policy created with the previous commands.
Example 2: Get base hourly retention object for fileshare policy
$retentionPolicy = Get-AzRecoveryServicesBackupRetentionPolicyObject -WorkloadType AzureFiles -BackupManagementType AzureStorage -ScheduleRunFrequency Hourly
$retentionPolicy.DailySchedule.DurationCountInDays = 10
The first command gets a base hourly RetentionPolicy object, and then stores it in the $retentionPolicy variable. Similarly the retention hourly policy can be fetched for enhanced hourly schedule for other workloads. The second command sets the retention duration for daily recovery points to 10 days.
Parameters
-BackupManagementType
The class of resources being protected. The acceptable values for this parameter are:
- AzureVM
- AzureWorkload
- AzureStorage
Parameter properties
Type: | |
Default value: | None |
Accepted values: | AzureVM, AzureStorage, AzureWorkload |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 1 |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-BackupTier
Backup tier for the resource. The current supported values are Snapshot, VaultStandard
Parameter properties
Type: | BackupTierType |
Default value: | None |
Accepted values: | Snapshot, VaultStandard |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 3 |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with azure.
Parameter properties
Type: | IAzureContextContainer |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ScheduleRunFrequency
Frequency of the schedule for which base retention policy object is fetched. Acceptable values are Daily and Hourly.
Parameter properties
Type: | ScheduleRunType |
Default value: | None |
Accepted values: | Daily, Hourly, Weekly |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 2 |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-WorkloadType
Workload type of the resource. The acceptable values for this parameter are:
- AzureVM
- AzureFiles
- MSSQL
Parameter properties
Type: | WorkloadType |
Default value: | None |
Accepted values: | AzureVM, AzureFiles, MSSQL |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 0 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.