Commands › Exchange Online

Set-ComplianceTag

Exchange Online ExchangeOnlineManagement Set-*

For more information, see Security & Compliance PowerShell. Use the Set-ComplianceTag cmdlet to modify retention labels in the Microsoft Purview compliance portal. Retention labels apply retention settings to content.

Quick start script

# Set-ComplianceTag — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-ComplianceTag
$before | Format-List

# 3. Make the change (dry run first)
Set-ComplianceTag -Identity <ComplianceRuleIdParameter> -WhatIf
Set-ComplianceTag -Identity <ComplianceRuleIdParameter>

# 4. Verify and diff
$after = Get-ComplianceTag
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax — 2 parameter sets

Default

Set-ComplianceTag [-Identity] <ComplianceRuleIdParameter>
 [-AutoApprovalPeriod <System.Int32>]
 [-Comment <String>]
 [-ComplianceTagForNextStage <String>]
 [-Confirm]
 [-EventType <ComplianceRuleIdParameter>]
 [-FilePlanProperty <String>]
 [-FlowId <System.Guid>]
 [-Force]
 [-MultiStageReviewProperty <String>]
 [-Notes <String>]
 [-RetentionDuration <Unlimited>]
 [-ReviewerEmail <SmtpAddress[]>]
 [-WhatIf]
 [<CommonParameters>]

PriorityCleanup

Set-ComplianceTag [-Identity] <ComplianceRuleIdParameter> [-PriorityCleanup]
 [-Comment <String>]
 [-Confirm]
 [-Force]
 [-MultiStageReviewProperty <String>]
 [-Notes <String>]
 [-RetentionDuration <Unlimited>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (15)

ParameterTypeRequiredWhat it controls
-Identity ComplianceRuleIdParameter yes The Identity parameter specifies the label that you want to modify. You can use any value that uniquely identifies the tag. For example:
-AutoApprovalPeriod Int32 {{ Fill AutoApprovalPeriod Description }}
-Comment String The Comment parameter specifies an optional comment. If you specify a value that contains spaces, enclose the value in quotation marks ("), for example: "This is an admin note".
-ComplianceTagForNextStage String {{ Fill ComplianceTagForNextStage Description }}
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-EventType ComplianceRuleIdParameter The EventType specifies the retention rule that's associated with the label. You can use any value that uniquely identifies the rule. For example:
-FilePlanProperty String The FilePlanProperty parameter specifies the file plan properties to include in the label. To view the file plan property names that you need to use in this parameter, run the following commands:
-FlowId Guid **Note**: This parameter is currently in Preview, is not available in all organizations, and is subject to change.
-Force SwitchParameter The Force switch hides warning or confirmation messages. You don't need to specify a value with this switch.
-MultiStageReviewProperty String The MultiStageReviewProperty parameter specifies the multi-stage review properties to include in the label. This parameter uses the following syntax:
-Notes String The Notes parameter specifies an optional note. If you specify a value that contains spaces, enclose the value in quotation marks ("), for example: "This is a user note".
-PriorityCleanup SwitchParameter {{ Fill PriorityCleanup Description }}
-RetentionDuration Unlimited The RetentionDuration parameter specifies the number of days to retain the content. Valid values are:
-ReviewerEmail SmtpAddress[] The ReviewerEmail parameter specifies the email address of a reviewer for Delete and KeepAndDelete retention actions. You can specify multiple email addresses separated by commas.
-WhatIf SwitchParameter The WhatIf switch doesn't work in Security & Compliance PowerShell.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.