Create Teams in bulk from CSV – Microsoft Teams

Create Teams in bulk from CSV – Microsoft Teams

In this quick blog post we are going to look at how to create Teams in bulk from CSV. This can be really handy if you work in an environment where there is a need to create a large number of Teams in one go, such as class teams for Education, or where there is no data sync.

Background

Here we are looking at how to create Teams in bulk from CSV in their most basic form. We want to do this from a CSV file as its really easy to setup the data in Excel. The advantage to bulk creation is time saving, when you have a million and one things to do, you do not want to sit down and create manual teams.

Prerequisites

Before you get started, your going to need the correct permissions in Microsoft 365. You need the permissions to create Teams, and the correct permissions in AzureAD. If you are not a global administrator like me, you will need to speak to your GA to get the correct permissions.

You are also going to need the Teams PowerShell module, if you are unsure on how to add this, please see the Microsoft Docs Install Microsoft Teams PowerShell – Microsoft Teams | Microsoft Learn

Lets Get Started

Firstly, fire up Excel. Create the following columns with the following data

  • TeamName – The name of the Team, as it will appear to your users
  • TeamDescription – Team description, this can be the same, or you can add additional details
  • TeamType – This may not be required but this is the template, usually used for Education
  • Owners – This is one in our example but can be many more separated by commas (,)

Save the CSV to C:\Temp and call it NewTeams.csv. This can be changed but make sure you change the PowerShell reference location

Below is the example of a CSV

Example CSV of Teams and owner

You can add more columns, such as Members, remember you will need to add more items to the PowerShell script

#Add your username here to make use of SSO
$User = '[email protected]'

#Import the Microsoft Teams PowerShell Module
Import-module MicrosoftTeams

#Connect to Microsoft Teams PowerShell environment using your user account
Connect-MicrosoftTeams -AccountId $User

#Import the CSV file from here and create an environment variable for it called Teams
$Teams = Import-CSV C:\Temp\NewTeams.csv

#Run New-Team with the details from the CSV
Foreach($Column in $teams)
{
New-Team -DisplayName $Column.TeamName -Owner $Column.Owners -Description $Column.TeamDescription -Template $Column.TeamType
}

Once you have run the PowerShell, you will have created the new Teams specified in your CSV. What’s better still, the owners will automatically see the Teams so they can start using them right away.

Comments are closed.