🔧 New: User Management Graph PowerShell Toolkit

Simplify user tasks like bulk creation, updates, password resets, deletions, license checks & more — all from one place.

🚀 Launch Toolkit

Bulk Create Microsoft Teams Using Graph PowerShell and CSV Input

Managing multiple Teams manually can be time-consuming. This article provides a streamlined solution to bulk create Microsoft Teams directly using Graph PowerShell and a CSV input file. Whether you're onboarding new departments, projects, or functional teams, this method helps automate Team creation quickly and consistently.


Script: Bulk Create Microsoft Teams from CSV

# Connect to Microsoft Graph with required permissions
Connect-MgGraph -Scopes "Team.Create", "User.Read.All", "Group.ReadWrite.All"
                                
# Import the CSV containing team details
$teams = Import-Csv -Path "teams.csv"
                                
foreach ($team in $teams) {
    $params = @{
        "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
        displayName           = $team.DisplayName
        description           = $team.Description
        firstChannelName      = $team.FirstChannelName
    }
                                
    try {
        New-MgTeam -BodyParameter $params
        Write-Host "✅ Team '$($team.DisplayName)' created successfully." -ForegroundColor Green
    } catch {
        Write-Host "❌ Failed to create team '$($team.DisplayName)': $_" -ForegroundColor Red
    }
}
                            

Sample CSV File (teams.csv)

DisplayName,Description,FirstChannelName
Team Alpha,Alpha project team,General
Team Beta,Beta development group,Updates

Each row in the CSV represents one team to be created. You can name the file teams.csv and update it as needed.


How the Script Works

  1. Connects to Microsoft Graph using the necessary scopes:
    • Team.Create – to create new Microsoft Teams
    • User.Read.All – to retrieve user context (optional but useful for expansion)
    • Group.ReadWrite.All – to allow group creation (Teams are backed by M365 groups)
  2. Reads the CSV file which contains team metadata including:
    • Display name
    • Description
    • First channel name
  3. Iterates through each entry and constructs a request body contains in $params hashtable:
    • displayName – sets the name of the team
    • description – sets the team description
    • "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
      defines the template using which the team will be created.
  4. Creates the team using New-MgTeam -BodyParameter $params command.
  5. Logs the result for each team created, and catches any errors.

Further Enhancements

Here are a few ways to expand this script:

Feature Description
Add Owners Use New-MgGroupOwnerByRef for ownership assignment.
Add Multiple Channels Use New-MgTeamChannel after team creation to add additional channels.
Add Retry Logic To handle throttling or provisioning delays gracefully.
Log to CSV Export a log of successes/failures for tracking purposes.
License Check Validate that the user running the script has Teams license or admin rights.


Possible Errors & Solutions

Error Cause Fix
Insufficient privileges to complete the operation. Missing permission scopes during Connect-MgGraph Use: Connect-MgGraph -Scopes "Team.Create", "Group.ReadWrite.All", "User.Read.All"
InvalidAuthenticationToken Expired or invalid session Re-run Connect-MgGraph to reauthenticate
BadRequest: Template binding not specified Missing template@odata.bind in parameters Ensure the body includes "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')"
Team creation failed after retry Backend delay in group provisioning Add delay or retry logic with Start-Sleep and try-catch
Property 'firstChannelName' does not exist Typo or incorrect casing Ensure the property is spelled exactly as firstChannelName

Conclusion

With Microsoft Graph PowerShell and a simple CSV, you can automate the creation of Microsoft Teams in bulk — saving hours of manual work. This script is not only efficient but also extensible, allowing you to build more powerful provisioning workflows by adding owners, members, and channels.

If you're managing Teams at scale, this approach will greatly simplify your day-to-day administration.


Graph PowerShell Explorer Widget

20 Graph PowerShell cmdlets with easily accessible "working" examples.


Permission Required

Example:


                


                


                

© m365corner.com. All Rights Reserved. Design by HTML Codex