Recently I was tasked to add 600 users to a Team in Microsoft Teams, and you can do that easily by using a Powershell script, here is what you can do.
First, generate a CSV with all the users you will need to add to the Team with only two columns, the email and Role (owner or member).
Here is an example of the CSV. Remember, the first row is the header so it must be present in the file.
Now we need to connect to the Microsoft Teams console by using the command below.
Connect-MicrosoftTeams
After connected, we need to get the GroupID of the Team by providing its name.
Get-Team | Where {$_.DisplayName -eq "<Team Name>"} | Select -ExpandProperty GroupID
The script above will return the GroupID, save write it down to use in the next command.
Load the CSV into a variable, iterate through it by adding each user to the Team.
$TeamUsers = Import-Csv -Path "<path to CSV>" -Delimiter ";"
$TeamUsers | ForEach-Object {
Add-TeamUser -GroupId "<GroupID discovered earlier>" -User $_.Email -Role $_.Role
Write-host "Added User:"$_.Email -f Green
}
Thats it, super easy and saves a lot of time.