m365Corner
M365 Blogs

Ultimate Guide for Using New-MgTeam Cmdlet

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.

What Is Microsoft Teams?

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:

  • A shared mailbox and calendar in Outlook.
  • A SharePoint document library for file management.
  • Planner for task tracking.
  • OneNote for collaborative note-taking.

Teams can be created for various purposes, including department communication, project management, and cross-functional collaboration.

Why Use New-MgTeam?

The New-MgTeam cmdlet simplifies the process of creating Microsoft Teams programmatically. Key benefits include:

  • Automation: Create multiple Teams or replicate existing structures without manual effort.
  • Consistency: Ensure Teams follow standardized naming conventions, descriptions, and settings.
  • Scalability: Handle large-scale Team creation tasks efficiently.

By using New-MgTeam, administrators can save time, reduce errors, and maintain consistency across their Microsoft 365 environment.

Setting Up Microsoft Graph PowerShell

Before using the New-MgTeam cmdlet, you’ll need to install and configure the Microsoft Graph PowerShell module:

  1. Install Microsoft Graph PowerShell: Install the module with this command:
    Install-Module Microsoft.Graph -Scope CurrentUser
  2. Connect to Microsoft Graph: Establish a connection to your Microsoft 365 tenant with the required permissions:
    Connect-MgGraph -Scopes "Group.ReadWrite.All"
    You’ll be prompted to authenticate with your admin credentials.
  3. Disconnect After Use: Once you’ve completed your tasks, disconnect the session to ensure security:
    Disconnect-MgGraph

Practical Examples of New-MgTeam

Let’s dive into some practical use cases for New-MgTeam to demonstrate its flexibility and power.

Create a Single Team

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.

Create Multiple Teams from a CSV File

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.

Create a Team from an Existing Group

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  
                    

Key Parameters & Configuration Options (Quick Reference)

Understanding key properties helps you create Teams more effectively.

Parameter Required Purpose
DisplayName Yes Name of the Team
description Yes Team description
template@odata.bind Yes Defines Team template (standard, education, etc.)
visibility Recommended Public or Private Team
AccountEnabled Yes Enable/disable account/td>
members Optional Add users during creation
channels Optional Pre-create channels
memberSettings Optional Control user permissions
messagingSettings Optional Control messaging behavior
💡 Properties like memberSettings and messagingSettings allow fine control over team behavior, but default values apply if omitted.

When Should You Use New-MgTeam?

Use the New-MgTeam cmdlet in the following real-world scenarios:

  • Bulk Team creation for departments, projects, or regions
  • Standardized Team provisioning with predefined settings/li>
  • Automating onboarding workflows (create Team + channels + members)
  • Converting existing Microsoft 365 Groups into Teams
💡 PowerShell automation is especially useful in large environments where manual creation is not scalable.

New-MgTeam vs Teams Admin Center

Method Best For Limitation
New-MgTeam (PowerShell) Automation & bulk provisioning Requires scripting knowledge
Teams Admin Center Manual setup Time-consuming for large scale
Templates via UI Quick setup Limited customization
💡 For enterprise environments, New-MgTeam provides consistency and automation advantages.

Real-World Automation Scenarios

  1. Department-Based Team Provisioning
    • Automatically create Teams for HR, IT, Finance
    • Apply consistent naming and structure
  2. Project-Based Team Creation
    • Create Teams dynamically for new projects
    • Add channels like Planning, Execution, Reports
  3. Bulk Team Creation via CSV
    • Import team details and create multiple Teams at once
    • Ideal for large-scale deployments
  4. Converting Existing Groups to Teams
    • Reuse existing Microsoft 365 Groups
    • Attach Teams functionality using group@odata.bind
💡 This flexibility makes New-MgTeam suitable for both new deployments and existing environments.

Advanced Tips for New-MgTeam Usage

  • Customize Team Templates: You can use different templates for Teams creation, such as Education or Retail. Update the template@odata.bind value to match the required template:
    https://graph.microsoft.com/v1.0/teamsTemplates('educationClass')  
  • Automate End-to-End Workflows: Combine New-MgTeam with other cmdlets like Add-MgTeamMember to automate complete Team setups, including adding members and setting permissions.
  • Simulate Commands Before Execution: Use the -WhatIf parameter to preview the results of a command without making changes:
    New-MgTeam -BodyParameter $team -WhatIf 

Common Limitations & Considerations

Strengths

  • Automates team creation at scale
  • Supports advanced customization
  • Integrates with full Graph ecosystem

Limitations

  • Requires correct permissions (e.g., Group.ReadWrite.All, Team.Create)
  • Some configurations may require additional cmdlets post-creation
  • Slight learning curve for complex templates

Pro Tips for Using New-MgTeam

  • Always define a template (standard, educationClass, etc.)
  • Use CSV-based automation for bulk operations
  • Combine with Add-MgTeamMember for full provisioning
  • Validate naming conventions before creation
  • Use -WhatIf to simulate changes before execution
💡 These practices ensure reliable and scalable automation.

Example: End-to-End Team Provisioning Workflow

A practical automation workflow could look like:

  1. Create Team using New-MgTeam
  2. Add members using Add-MgTeamMember
  3. Create channels using New-MgTeamChannel
  4. Apply policies and settings
  5. Integrate with Planner and SharePoint
💡 This approach ensures a fully functional Team from day one.

Frequently Asked Questions (FAQs)

  1. What is New-MgTeam used for?
    New-MgTeam is used to create Microsoft Teams programmatically using Graph PowerShell, enabling automation and bulk provisioning.
  2. What permissions are required for New-MgTeam?
    You need permissions such as Group.ReadWrite.All and Team.Create to create Teams successfully.
  3. Can I create multiple Teams using New-MgTeam?
    Yes, you can import data from a CSV file and create multiple Teams in bulk using PowerShell scripts.
  4. Can I create a Team from an existing Microsoft 365 Group?
    Yes, using the group@odata.bind property, you can convert an existing group into a Team.
  5. Does New-MgTeam create channels automatically?
    By default, only the general channel is created, but you can define additional channels during creation using the channels property.

Conclusion

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!

🚀 Community Edition Released!

Try the M365Corner Microsoft 365 Reporting Tool — your DIY pack with 20+ out-of-the-box M365 reports for Users, Groups, and Teams

Get it on GitHub Know More