Adding users in bulk to Microsoft DLP and retention policies for Microsoft Teams

Posted on

It is possible to perform a bulk addition of users to Microsoft DLP and retention policies for Microsoft Teams with PowerShell cmdlets. It’s actually pretty simple and straight forward, as you will see below.

A few tips:

  • This uses the Exchange Online Management V2 module – install the module before importing it.  Install the EXO V2 module | Microsoft Docs
  • To install and connect to EXO, follow the top 2 commands outlined at Connect to Security & Compliance Center PowerShell using the EXO V2 module | Microsoft Docs.
  • My observation is that the cmdlets will insert new records, not overwrite them.  Test this on a sample retention policy first! I recommend adding a second test user account immediately after, so that you can experience that the users are truly added to the existing list (i.e. the list is not overwritten with just that single user).
  • Remember to first connect using the Connect-IPPSSession cmdlet.

Two example commands to get you started: