Commands › Exchange Online

New-AppRetentionCompliancePolicy

Exchange Online ExchangeOnlineManagement New-*

For more information, see Security & Compliance PowerShell. Use the New-AppRetentionCompliancePolicy to create app retention compliance policies. App retention & labeling policies target new ways to scope and manage policies.

Quick start script

# New-AppRetentionCompliancePolicy — 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-AppRetentionCompliancePolicy
$before | Format-List

# 3. Make the change (dry run first)
New-AppRetentionCompliancePolicy -Name <String> -AdaptiveScopeLocation <MultiValuedProperty> -Applications <String[]> -WhatIf
New-AppRetentionCompliancePolicy -Name <String> -AdaptiveScopeLocation <MultiValuedProperty> -Applications <String[]>

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

Syntax — 2 parameter sets

AdaptiveScopeLocation

New-AppRetentionCompliancePolicy [-Name] <String> -AdaptiveScopeLocation <MultiValuedProperty> -Applications <String[]>
 [-Confirm]
 [-Comment <String>]
 [-Enabled <Boolean>]
 [-Force]
 [-RestrictiveRetention <Boolean>]
 [-WhatIf]
 [<CommonParameters>]

Default

New-AppRetentionCompliancePolicy [-Name] <String> -Applications <String[]>
 [-Comment <String>]
 [-Confirm]
 [-Enabled <Boolean>]
 [-ExchangeLocation <MultiValuedProperty>]
 [-ExchangeLocationException <MultiValuedProperty>]
 [-Force]
 [-ModernGroupLocation <MultiValuedProperty>]
 [-ModernGroupLocationException <MultiValuedProperty>]
 [-PolicyRBACScopes <MultiValuedProperty>]
 [-RestrictiveRetention <Boolean>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (14)

ParameterTypeRequiredWhat it controls
-Name String yes The Name parameter specifies a unique name for the app retention compliance policy. The maximum length is 64 characters. If the value contains spaces, enclose the value in quotation marks (").
-AdaptiveScopeLocation MultiValuedProperty yes The AdaptiveScopeLocation parameter specifies the adaptive scope location to include in the policy. You create adaptive scopes by using the New-AdaptiveScope cmdlet. You can use any value that uniquely identifies the...
-Applications String[] yes The Applications parameter specifies the applications to include in the 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.
-Enabled Boolean The Enabled parameter enables or disables the policy. Valid values are:
-ExchangeLocation MultiValuedProperty The ExchangeLocation parameter specifies the mailboxes to include in the policy. Valid values are:
-ExchangeLocationException MultiValuedProperty The ExchangeLocationException parameter specifies the mailboxes exclude from the policy when you use the value All for the ExchangeLocation parameter. Valid values are:
-Force SwitchParameter The Force switch hides warning or confirmation messages. You don't need to specify a value with this switch.
-ModernGroupLocation MultiValuedProperty The ModernGroupLocation parameter specifies the Microsoft 365 Groups to include in the policy. Valid values are:
-ModernGroupLocationException MultiValuedProperty The ModernGroupLocationException parameter specifies the Microsoft 365 Groups to exclude from the policy when you use the value All for the ModernGroupLocation parameter.
-PolicyRBACScopes MultiValuedProperty **Note**: Admin units aren't currently supported, so this parameter isn't functional. The information presented here is for informational purposes when support for admin units is released.
-RestrictiveRetention Boolean The RestrictiveRetention parameter specifies whether Preservation Lock is enabled for the policy. Valid values are:
-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.