편집

다음을 통해 공유


Edit-AzDataProtectionPolicyRetentionRuleClientObject

Adds or removes Retention Rule to existing Policy

Syntax

Edit-AzDataProtectionPolicyRetentionRuleClientObject
    -Policy <IBackupPolicy>
    -Name <RetentionRuleName>
    [-RemoveRule]
    [<CommonParameters>]
Edit-AzDataProtectionPolicyRetentionRuleClientObject
    -Policy <IBackupPolicy>
    -Name <RetentionRuleName>
    -IsDefault <Boolean>
    -LifeCycles <ISourceLifeCycle[]>
    [-OverwriteLifeCycle <Boolean>]
    [<CommonParameters>]

Description

Adds or removes Retention Rule to existing Policy

Examples

Example 1: Add Weekly Retention Rule

$pol = Get-AzDataProtectionPolicyTemplate
$lifecycle = New-AzDataProtectionRetentionLifeCycleClientObject -SourceDataStore OperationalStore -SourceRetentionDurationType Weeks -SourceRetentionDurationCount 5
Edit-AzDataProtectionPolicyRetentionRuleClientObject -Policy $pol -Name Weekly -LifeCycles $lifecycle -IsDefault $false

DatasourceType            ObjectType
--------------            ----------
{Microsoft.Compute/disks} BackupPolicy

The first command gets the default policy template. The second command creates a weekly lifecycle object. The third command adds a weekly retention rule to the default policy.

Example 2: Remove Weekly Retention Rule

Edit-AzDataProtectionPolicyRetentionRuleClientObject -Policy $pol -Name Weekly -RemoveRule

DatasourceType            ObjectType
--------------            ----------
{Microsoft.Compute/disks} BackupPolicy

This command removes weekly retention rule if it exists in given backup policy.

Parameters

-IsDefault

Specifies if retention rule is default retention rule.

Type:Boolean
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-LifeCycles

Life cycles associated with the retention rule. To construct, see NOTES section for LIFECYCLES properties and create a hash table.

Type:ISourceLifeCycle[]
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

Retention Rule Name

Type:RetentionRuleName
Accepted values:Default, Daily, Weekly, Monthly, Yearly
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-OverwriteLifeCycle

Specifies whether to modify an existing LifeCycle.

Type:Nullable<T>[Boolean]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Policy

Backup Policy Object To construct, see NOTES section for POLICY properties and create a hash table.

Type:IBackupPolicy
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RemoveRule

Specifies whether to remove the retention rule.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Outputs

IBackupPolicy