Set retention policy for Team chat and files using PowerShell

Tanmoy Das 801 Reputation points


How to set a retention policy for Team chats and files using PowerShell in Azure function app.


Microsoft Defender for Cloud
Microsoft Defender for Cloud
An Azure service that provides threat protection for workloads running in Azure, on-premises, and in other clouds. Previously known as Azure Security Center and Azure Defender.
1,118 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Marilee Turscak-MSFT 32,456 Reputation points Microsoft Employee

    The examples for setting a retention policy for Teams via Powershell are covered in this document:

       [-Identity] <PolicyIdParameter>  
       [-AddTeamsChannelLocation <MultiValuedProperty>]  
       [-AddTeamsChannelLocationException <MultiValuedProperty>]  
       [-AddTeamsChatLocation <MultiValuedProperty>]  
       [-AddTeamsChatLocationException <MultiValuedProperty>]  
       [-Comment <String>]  
       [-Enabled <Boolean>]  
       [-RemoveTeamsChannelLocation <MultiValuedProperty>]  
       [-RemoveTeamsChannelLocationException <MultiValuedProperty>]  
       [-RemoveTeamsChatLocation <MultiValuedProperty>]  
       [-RemoveTeamsChatLocationException <MultiValuedProperty>]  

    What is your goal with the function app? This blog post has an example that sets a timer triggered Powershell function, and it may be what you are looking for.