en-US

AppRetentionCompliancePolicy

Applies to : Security & Compliance

This cmdlet is available only in Security & Compliance PowerShell. For more information, see Security & Compliance PowerShell.

Use the Set-AppRetentionCompliancePolicy to modify app retention compliance policies.

For information about the parameter sets in the Syntax section below, see Exchange cmdlet syntax.

\*-AppRetentionCompliance\* cmdlets are used for policies with adaptive policy scopes and all static policies in the locations described in Retention cmdlets for newer locations. You can only set the list of included or excluded scopes for all included workloads, which means you likely need to create one policy per workload.

\*-RetentionCompliance\* cmdlets continue to primarily support the locations described in Retention cmdlets for older locations.

To use this cmdlet in Security & Compliance PowerShell, you need to be assigned permissions. For more information, see Permissions in the Microsoft Purview compliance portal.

Available cmdlets

Parameters

Name Type Default value Accepted values
RetryDistribution SwitchParameter
AddAdaptiveScopeLocation MultiValuedProperty
AddExchangeLocation MultiValuedProperty
AddExchangeLocationException MultiValuedProperty
AddModernGroupLocation MultiValuedProperty
AddModernGroupLocationException MultiValuedProperty
Applications String[]
Comment String
DeletedResources String
Enabled Boolean
PolicyRBACScopes MultiValuedProperty
RemoveAdaptiveScopeLocation MultiValuedProperty
RemoveExchangeLocation MultiValuedProperty
RemoveExchangeLocationException MultiValuedProperty
RemoveModernGroupLocation MultiValuedProperty
RemoveModernGroupLocationException MultiValuedProperty
RestrictiveRetention Boolean

Examples

Example 1

Set-AppRetentionCompliancePolicy -Identity "Regulation 563 Marketing" -Applications "User:MicrosoftTeams","Group:MicrosoftTeams,VivaEngage" -AddExchangeLocation "Scott Smith" -Comment "Added new counsel, 9/9/21"

This example adds a new user to the existing static scope retention policy named Regulation 563 Marketing that's set up for Teams private channels messages.

Example 2

$stringJson = @"
[{
     'EmailAddress': '[email protected]'
}]
"@
Set-AppRetentionCompliancePolicy -Identity "Teams Private Channel Retention Policy" -AddExchangeLocationException "[email protected]" -DeletedResources $stringJson

This example excludes the specified soft-deleted mailbox or mail user from the retention policy configured for Teams private channel messages. You can identify the deleted resources using the mailbox or mail user's email address.

IMPORTANT: Before you run this command, make sure you read the Caution information for the DeletedResources parameter about duplicate SMTP addresses.

Policy exclusions must remain within the supported limits for retention policies. For more information, see Limits for Microsoft 365 retention policies and retention label policies.

Example 3

$stringJson = @"
[{
     'EmailAddress': '[email protected]'
},
{
     'EmailAddress': '[email protected]'
}]
"@
Set-AppRetentionCompliancePolicy -Identity "Teams Private Chat Retention Policy" -AddExchangeLocationException "[email protected]", "[email protected]" -DeletedResources $stringJson

This example is similar to Example 2, except multiple deleted resources are specified.

IMPORTANT: Before you run this command, make sure you read the Caution information for the DeletedResources parameter about duplicate SMTP addresses.

Microsoft Learn documentation