Add Members or unified group to all teams

Copper Contributor


We have several Team(s).

When we have to add a new member or a unified group (with their members) to this team(s) is time waste activity 


We looking for a way to do this in bulk with Powershell or by another way.


1 Reply
It's fairly easy to automate, either via PowerShell or the Graph API. Here's a short example:

Import-CSV blabla.csv | { Add-UnifiedGroupLinks $_.GroupId -LinkType Member -Links $_.UserId }

where the CSV file has a column GroupID to designate the Group/Team, and a column UserId to designate the user(s) you want added. Make sure to use unique-valued attribute, such as the UPN or ObjectID when populating these properties.

Here's also an example where you expand the current membership of a Group/Team to another Team:

Get-UnifiedGroupLinks GroupID -LinkType Member | % { Add-UnifiedGroupLinks TeamName -LinkType Members -Links $_.ExternalDirectoryObjectId }