Microsoft Teams has emerged as one of the most popular tools for collaboration in the workplace. Whether it’s managing projects, hosting virtual meetings, or sharing files, Teams ensures seamless communication and productivity across organizations.
Creating and managing Teams efficiently is a key responsibility for Microsoft 365 administrators. While the Teams Admin Center provides a graphical interface, the New-MgTeam cmdlet offers a powerful way to automate Team creation tasks and integrate them into larger workflows.
Microsoft Teams is a collaboration platform within Microsoft 365 that integrates chat, video conferencing, file sharing, and productivity tools. Each Team connects users with shared resources like:
Teams can be created for various purposes, including department communication, project management, and cross-functional collaboration.
The New-MgTeam cmdlet simplifies the process of creating Microsoft Teams programmatically. Key benefits include:
By using New-MgTeam, administrators can save time, reduce errors, and maintain consistency across their Microsoft 365 environment.
Before using the New-MgTeam cmdlet, you’ll need to install and configure the Microsoft Graph PowerShell module:
Install-Module Microsoft.Graph -Scope CurrentUser
Connect-MgGraph -Scopes "Group.ReadWrite.All"
You’ll be prompted to authenticate with your admin credentials.Disconnect-MgGraph
Let’s dive into some practical use cases for New-MgTeam to demonstrate its flexibility and power.
To create a single Microsoft Team with basic settings:
$team = @{ DisplayName = "Team Name" Description = "This is a sample team" Visibility = "Public" "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" } New-MgTeam -BodyParameter $team
This creates a public Team named "Team Name" using the standard Teams template.
For bulk Team creation, you can import details from a CSV file.
CSV File Example:
DisplayName,Description,Visibility
"Finance Team","Team for finance department","Private"
"HR Team","Team for HR department","Public"
$teams = Import-Csv -Path "C:\path\to\teams.csv" foreach ($team in $teams) { $teamParams = @{ DisplayName = $team.DisplayName Description = $team.Description Visibility = $team.Visibility "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" } New-MgTeam -BodyParameter $teamParams }
This script creates a Team for each row in the CSV file, ensuring consistency and scalability.
If you already have an Office 365 group and want to convert it into a Team:
$params = @{ "template@odata.bind" = "https://graph.microsoft.com/v1.0/teamsTemplates('standard')" "group@odata.bind" = "https://graph.microsoft.com/v1.0/groups('your-group-id')" } New-MgTeam -BodyParameter $params
https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')
New-MgTeam -BodyParameter $team -WhatIf
The New-MgTeam cmdlet is a versatile tool that empowers Microsoft 365 administrators to create Teams programmatically. Whether you’re handling a single Team, performing bulk creation, or converting existing groups, this cmdlet simplifies workflows and ensures consistency.
By mastering New-MgTeam and following best practices, you can streamline your organization’s Teams management and boost productivity.
Start scripting with New-MgTeam today and take control of your Microsoft 365 Teams environment!
Did You Know? Managing Microsoft 365 applications is even easier with automation. Try our Graph PowerShell scripts to automate tasks like generating reports, cleaning up inactive Teams, or assigning licenses efficiently.
Ready to get the most out of Microsoft 365 tools? Explore our free Microsoft 365 administration tools to simplify your administrative tasks and boost productivity.
© M365Corner. All Rights Reserved.