Add Multiple Users to a Microsoft Teams Team Using PowerShell

In this blog post, I will show you how to add multiple users to an existing Microsoft Teams Team using a CSV file and PowerShell.

There is no doubt that PowerShell and CSV make our life extremely easy when it comes to Office 365 management.

This example will show how handy it is to use PowerShell for MS Teams management.

CSV

Below, you can see the CSV file template that I’m using.

The template contains the email addresses and the column name, which in my case is called upn.

upn

Email1@domainname.co

Email2@domainname.co

Install Teams PowerShell Module

To install the Microsoft Teams PowerShell module, I will use the following command.

Install-module microsoftteams

Connect To MS Teams

To connect to Microsoft Teams using PowerShell I will run the following command.

Connect-microsoftteams

Add Users

Before I can run my script and add users from the CSV file I need to find the Group ID of the MS Teams Team I would like to add the users to.

To check the Group ID of my Team, I will run the following command and copy the Team’s GroupID value.

Get-Team | select groupid, display*

To add the users to my MS Teams Team, I will run the following command using the copied GROUPID value.

Import-Csv -Path "users.csv" | foreach{Add-TeamUser -GroupId GROUPID -user $_.upn}

Check Members

To check if the command was successful, I will then run the following command with the GROUPID

Get-TeamUser -GroupId GROUPID | select user

Processing…
Success! You're on the list.

2 Replies to “Add Multiple Users to a Microsoft Teams Team Using PowerShell”

  1. Unfortunately, the command is unstable. There is a very long delay before the changes are reflected. The commands are still in beta.

  2. Hi!
    Thank you for sharing the useful information. Will you teach how to add multiple users to channel?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.