Get-AzRecoveryServicesBackupRetentionPolicyObject

Gets a base retention policy object.

Syntax

Get-AzRecoveryServicesBackupRetentionPolicyObject
   [-WorkloadType] <WorkloadType>
   [[-BackupManagementType] <BackupManagementType>]
   [-DefaultProfile <IAzureContextContainer>]
   [<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

PS C:\>$RetPol = Get-AzRecoveryServicesBackupRetentionPolicyObject -WorkloadType AzureVM 
PS C:\> $RetPol.DailySchedule.DurationCountInDays = 365
PS C:\> $SchPol = Get-AzRecoveryServicesBackupSchedulePolicyObject -WorkloadType AzureVM 
PS C:\> 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.

Parameters

-BackupManagementType

Specifies the Backup management type. The acceptable values for this parameter are:

  • AzureVM
  • AzureSQLDatabase
  • AzureStorage
Type:System.Nullable`1[Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.BackupManagementType]
Accepted values:AzureVM, MARS, SCDPM, AzureBackupServer, AzureSQL, AzureStorage, AzureWorkload
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:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, 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:Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.WorkloadType
Accepted values:AzureVM, AzureSQLDatabase, AzureFiles, MSSQL
Position:0
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets.Models.RetentionPolicyBase