< Back

Get-AzureRmRecoveryServicesBackupRetentionPolicyObject

Tue Jan 29, 2019 10:00 pm

NAME Get-AzureRmRecoveryServicesBackupRetentionPolicyObject



SYNOPSIS

Gets a base retention policy object.





SYNTAX

Get-AzureRmRecoveryServicesBackupRetentionPolicyObject [-WorkloadType] {AzureVM | AzureSQLDatabase} [[-BackupManagementType] {AzureVM | MARS |

SCDPM | AzureBackupServer | AzureSQL}] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]





DESCRIPTION

The Get-AzureRmRecoveryServicesBackupRetentionPolicyObject 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-AzureRmRecoveryServicesBackupProtectionPolicy

cmdlet to create a new backup policy.





PARAMETERS

-BackupManagementType <BackupManagementType>

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



- AzureVM



- AzureSQLDatabase



Required? false

Position? 1

Default value None

Accept pipeline input? False

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



-WorkloadType <WorkloadType>

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



- AzureVM



- AzureSQLDatabase



Required? true

Position? 0

Default value None

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

This cmdlet does not accept any input.





OUTPUTS

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







NOTES









Example 1: Create a backup protection policy



PS C:\\>$RetPol = Get-AzureRmRecoveryServicesBackupRetentionPolicyObject -WorkloadType AzureVM

PS C:\\> $RetPol.DailySchedule.DurationCountInDays = 365

PS C:\\> $SchPol = Get-AzureRmRecoveryServicesBackupSchedulePolicyObject -WorkloadType AzureVM

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 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.







RELATED LINKS

Online Version:

https://docs.microsoft.com/en-us/powers ... licyobject

Get-AzureRmRecoveryServicesBackupSchedulePolicyObject

New-AzureRmRecoveryServicesBackupProtectionPolicy