New-RetentionCompliancePolicy and Teams

Published on Wednesday, August 21, 2019

teamsSoHot

There is a nice post here explaining how Retention policies for Microsoft Teams work, the intention of this blog post is not to talk about that but is kinda a quick cheat sheet if you happen to use the New-RetentionCompliancePolicy cmdlet for Teams.

New-RetentionCompliancePolicy includes four parameters related to Teams:

TeamsChannelLocation

The TeamsChannelLocation parameter is used to target specific Teams to include in the policy

TeamsChannelLocationException

This parameter specifies the Teams to exclude when you use the value All for the TeamsChannelLocation parameter

TeamsChatLocation

The TeamsChatLocation parameter is used to target specific Teams users to include in the policy

TeamsChatLocationException

This parameter specifies the Teams users to exclude when you use the value All for the TeamsChatLocation parameter

Now, some examples:

Example 1

New-RetentionCompliancePolicy -Name "Example1" -TeamsChannelLocation "All" -TeamsChannelLocationException "32996b0b-67f6-4159-b4bf-f738d12a5f86"

In this example the Retention applies to all Teams except the Team with GUID 32996b0b-67f6-4159-b4bf-f738d12a5f86, we can only specify an Exception when "All" is used for the location parameter.

Example 2

New-RetentionCompliancePolicy -Name "Example2" -TeamsChannelLocation "operations@M365x71714.onmicrosoft.com","systems@M365x71714.onmicrosoft.com"

In this example the Retention applies to the Teams operations and systems, as you can see, we are specifying the Teams with email address.

Example 3

New-RetentionCompliancePolicy -Name "Example3" -TeamsChatLocation "All" -TeamsChatLocationException
 "Allan Deyoung","Cameron White"

In this example the Retention applies to all users except Allan and Cameron, see that we are specifying them with their Name.

Example 4

New-RetentionCompliancePolicy -Name "Example4" -TeamsChatLocation "41f18a1c-2e21-4c6c-bca9-3b51a8d18a80"

In this example the Retention applies only to user with id 41f18a1c-2e21-4c6c-bca9-3b51a8d18a80, see that we are specifying them with their id we can get this id thru Azure AD.

We can specify Teams with their name, email, guid and users with their name, email, DN and guid.

One more thing...

One thing I noticed, is that, policies created using Powershell can't be edited later using the Office 365 Security & Compliance portal, hope Microsoft fix this soon. Also, if you use Get-RetentionCompliancePolicy to retrieve the newly created policies, you will notice that these attributes will be empty:

TeamsChatLocation             : {}

TeamsChatLocationException    : {}

TeamsChannelLocation          : {}

TeamsChannelLocationException : {}

Reason for that is that you need to use the -DistributionDetail parameter with it:

TeamsChatLocation             : {Debra Berger, Allan Deyoung}
TeamsChatLocationException    : {}
TeamsChannelLocation          : {}
TeamsChannelLocationException : {}

Hope this is useful for somebody.

comments powered by Disqus