Commands › Exchange Online

Set-LabelPolicy

Exchange Online ExchangeOnlineManagement Set-*

This cmdlet is functional only in Security & Compliance PowerShell. For more information, see Security & Compliance PowerShell. Use the Set-Label cmdlet to modify sensitivity label policies in your organization.

Quick start script

# Set-LabelPolicy — 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-LabelPolicy
$before | Format-List

# 3. Make the change (dry run first)
Set-LabelPolicy -Identity <PolicyIdParameter> -RetryDistribution <SwitchParameter> -WhatIf
Set-LabelPolicy -Identity <PolicyIdParameter> -RetryDistribution <SwitchParameter>

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

Syntax — 3 parameter sets

RetryDistribution

Set-LabelPolicy [-Identity] <PolicyIdParameter> -RetryDistribution
 [-AddLabels <MultiValuedProperty>]
 [-AdvancedSettings <PswsHashtable>]
 [-Confirm]
 [-MigrationId <String>]
 [-NextLabelPolicy <PolicyIdParameter>]
 [-PreviousLabelPolicy <PolicyIdParameter>]
 [-RemoveLabels <MultiValuedProperty>]
 [<CommonParameters>]

Identity

Set-LabelPolicy [-Identity] <PolicyIdParameter>
 [-AddExchangeLocation <MultiValuedProperty>]
 [-AddExchangeLocationException <MultiValuedProperty>]
 [-AddLabels <MultiValuedProperty>]
 [-AddModernGroupLocation <MultiValuedProperty>]
 [-AddModernGroupLocationException <MultiValuedProperty>]
 [-AddOneDriveLocation <MultiValuedProperty>]
 [-AddOneDriveLocationException <MultiValuedProperty>]
 [-AddPublicFolderLocation <MultiValuedProperty>]
 [-AddSharePointLocation <MultiValuedProperty>]
 [-AddSharePointLocationException <MultiValuedProperty>]
 [-AddSkypeLocation <MultiValuedProperty>]
 [-AddSkypeLocationException <MultiValuedProperty>]
 [-AdvancedSettings <PswsHashtable>]
 [-Comment <String>]
 [-Confirm]
 [-ExchangeAdaptiveScopes <MultiValuedProperty>]
 [-ExchangeAdaptiveScopesException <MultiValuedProperty>]
 [-MigrationId <String>]
 [-NextLabelPolicy <PolicyIdParameter>]
 [-PolicyRBACScopes <MultiValuedProperty>]
 [-RemoveExchangeLocation <MultiValuedProperty>]
 [-RemoveExchangeLocationException <MultiValuedProperty>]
 [-RemoveLabels <MultiValuedProperty>]
 [-RemoveModernGroupLocation <MultiValuedProperty>]
 [-RemoveModernGroupLocationException <MultiValuedProperty>]
 [-RemoveOneDriveLocation <MultiValuedProperty>]
 [-RemoveOneDriveLocationException <MultiValuedProperty>]
 [-RemovePublicFolderLocation <MultiValuedProperty>]
 [-RemoveSharePointLocation <MultiValuedProperty>]
 [-RemoveSharePointLocationException <MultiValuedProperty>]
 [-RemoveSkypeLocation <MultiValuedProperty>]
 [-RemoveSkypeLocationException <MultiValuedProperty>]
 [<CommonParameters>]

AdaptiveScopeLocation

Set-LabelPolicy [-Identity] <PolicyIdParameter>
 [-AddLabels <MultiValuedProperty>]
 [-AdvancedSettings <PswsHashtable>]
 [-Comment <String>]
 [-Confirm]
 [-Force]
 [-MigrationId <String>]
 [-NextLabelPolicy <PolicyIdParameter>]
 [-PreviousLabelPolicy <PolicyIdParameter>]
 [-RemoveLabels <MultiValuedProperty>]
 [-Setting <PswsHashtable>]
 [-Settings <PswsHashtable>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (39)

ParameterTypeRequiredWhat it controls
-Identity PolicyIdParameter yes The Identity parameter specifies the policy that you want to view. You can use any value that uniquely identifies the policy. For example:
-RetryDistribution SwitchParameter yes The RetryDistribution switch specifies whether to redistribute the policy to all Exchange Online locations. You don't need to specify a value with this switch.
-AddExchangeLocation MultiValuedProperty The AddExchangeLocation parameter specifies the mailboxes to add to the list of included mailboxes when you aren't using the value All for the ExchangeLocation parameter. A valid value is a mailbox.
-AddExchangeLocationException MultiValuedProperty The AddExchangeLocationException parameter specifies the mailboxes to add to the list of excluded mailboxes when you use the value All for the ExchangeLocation parameter. A valid value is a mailbox.
-AddLabels MultiValuedProperty The AddLabels parameter specifies the sensitivity labels that you want to add to the policy. You can use any value that uniquely identifies the label. For example:
-AddModernGroupLocation MultiValuedProperty The AddModernGroupLocation parameter specifies the Microsoft 365 Groups to add to the list of included Microsoft 365 Groups. To identify the Microsoft 365 Group, you must use the primary SMTP address.
-AddModernGroupLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddOneDriveLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddOneDriveLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddPublicFolderLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddSharePointLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddSharePointLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddSkypeLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AddSkypeLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-AdvancedSettings PswsHashtable The AdvancedSettings parameter enables client-specific features and capabilities for the sensitivity label policy.
-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".
-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.
-ExchangeAdaptiveScopes MultiValuedProperty {{ Fill ExchangeAdaptiveScopes Description }}
-ExchangeAdaptiveScopesException MultiValuedProperty {{ Fill ExchangeAdaptiveScopesException Description }}
-Force SwitchParameter The Force switch hides warning or confirmation messages. You don't need to specify a value with this switch.
-MigrationId String This parameter is reserved for internal Microsoft use.
-NextLabelPolicy PolicyIdParameter The NextLabelPolicy parameter updates the policy order so the policy that's specified by this parameter is after the current policy that you're modifying. You can use any value that uniquely identifies the policy....
-PolicyRBACScopes MultiValuedProperty The PolicyRBACScopes parameter specifies the administrative units to assign to the policy. A valid value is the Microsoft Entra ObjectID (GUID value) of the administrative unit. You can specify multiple values...
-PreviousLabelPolicy PolicyIdParameter The PreviousLabelPolicy parameter updates the policy order so the policy that's specified by this parameter is before the current policy that you're modifying. You can use any value that uniquely identifies the...
-RemoveExchangeLocation MultiValuedProperty The RemoveExchangeLocation parameter specifies the mailboxes to remove from the list of included mailboxes when you aren't using the value All for the ExchangeLocation parameter. Valid values are:
-RemoveExchangeLocationException MultiValuedProperty The RemoveExchangeLocationException parameter specifies the mailboxes to remove from the list of excluded mailboxes when you're using the value All for the ExchangeLocation parameter. Valid values are:
-RemoveLabels MultiValuedProperty The RemoveLabels parameter specifies the sensitivity labels that you want to remove from the policy. You can use any value that uniquely identifies the label. For example:
-RemoveModernGroupLocation MultiValuedProperty The RemoveModernGroupLocation parameter specifies the Microsoft 365 Groups to remove from the list of included groups. To identify the Microsoft 365 Group, you must use the primary SMTP address.
-RemoveModernGroupLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveOneDriveLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveOneDriveLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemovePublicFolderLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveSharePointLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveSharePointLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveSkypeLocation MultiValuedProperty This parameter is reserved for internal Microsoft use.
-RemoveSkypeLocationException MultiValuedProperty This parameter is reserved for internal Microsoft use.
-Setting PswsHashtable This parameter is reserved for internal Microsoft use.
-Settings PswsHashtable This parameter is reserved for internal Microsoft use.
-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.