Microsoft Teams PowerShell Module (Part 3): Provisioning & Removing Teams, Channels, and Users (New-Team & Remove-Team)

In Part 1 of our Microsoft Teams PowerShell series, we audited Teams using Get-Team, Get-TeamChannel, and Get-TeamUser. In Part 2, we hardened Team governance policies using Set-Team and Set-TeamChannel.

In Part 3, we complete the lifecycle by covering automated provisioning and decommissioning:

  • New-Team (Creating a brand-new Team or team-enabling an existing Microsoft 365 Unified Group)
  • New-TeamChannel (Provisioning Standard, Private, and B2B Shared channels)
  • Add-TeamUser (Adding Owners, Members, and Guests individually or in bulk via CSV)
  • Remove-TeamChannel, Remove-TeamUser, and Remove-Team (Archiving vs. Soft-Deleting Teams)

Microsoft Teams PowerShell Lifecycle Architecture (New-, Add-, Remove-*)

Microsoft Teams PowerShell Lifecycle: Provisioning, Channel Setup & Safe Decommissioning 1. Provision Team (New-Team) • Modern v6+ Parameters: -DisplayName "Project Alpha" -MailNickName "ProjAlpha" -Visibility Private • Or Team-Enable Existing Group: New-Team -GroupId $ExistingM365Id ! -Visibility replaced legacy -AccessType 2. Channels & Users (New / Add) • New-TeamChannel: -MembershipType Standard -MembershipType Private -Owner -MembershipType Shared • Add-TeamUser: -User $UPN -Role Owner / Member ✔ Supports Private Channel Roster too 3. Decommission (Archive vs Remove) • Granular Removal: Remove-TeamUser Remove-TeamChannel • Full Team Deletion: Set-TeamArchivedState (Read-Only) Remove-Team -GroupId $Id ! Deletes M365 Group & SharePoint site Critical Warning on `Remove-Team`: 1. `Remove-Team` deletes the underlying Microsoft 365 Unified Group, Exchange group mailbox, Planner plans, and SharePoint Online site. 2. For completed projects that require record retention, prefer `Set-TeamArchivedState -GroupId $Id -Archived $true` over `Remove-Team`.

1. New-Team: Provision a Brand-New Team (or Team-Enable an Existing M365 Group)

In the original 0.9.x preview of the module, New-Team used -Alias and -AccessType. In modern MicrosoftTeams (v6+), those parameters were standardized to -MailNickName and -Visibility (Private or Public), and you can set all governance guardrails directly during creation:

POWERSHELL
# Connect to Microsoft Teams
Connect-MicrosoftTeams

# 1. Create a new Private Project Team with hardened member/guest settings from Day 1
$NewTeam = New-Team -DisplayName "New Project Team" `
    -Description "Cross-functional engineering workspace for Project Alfa" `
    -MailNickName "NewPTeam" `
    -Visibility "Private" `
    -Owner "[email protected]" `
    -AllowCreateUpdateChannels $false `
    -AllowDeleteChannels $false `
    -AllowGuestCreateUpdateChannels $false `
    -AllowGuestDeleteChannels $false

Write-Host "[+] Created Team '$($NewTeam.DisplayName)' with GroupId: $($NewTeam.GroupId)" -ForegroundColor Green

# 2. Alternative: Team-Enable an EXISTING Microsoft 365 Unified Group (e.g., 'Compliance Admins')
# New-Team -GroupId "f8092e73-ed1b-4826-92a9-b9c1e408761b"
Tip: Always capture the output of New-Team into a variable ($NewTeam) so you can immediately pass $NewTeam.GroupId into New-TeamChannel and Add-TeamUser.

2. New-TeamChannel: Create Standard, Private, and Shared Channels

Using New-TeamChannel, you can provision traditional Standard channels (visible to everyone in the Team), Private channels (restricted to a subset of Team members with an isolated SharePoint site collection), or Shared channels (for B2B Direct Connect collaboration without switching tenants):

POWERSHELL
$GroupId = $NewTeam.GroupId # Or "255d4a49-5076-42c8-a109-45252a7244a7"

# 1. Create a Standard Channel
New-TeamChannel -GroupId $GroupId `
    -DisplayName "Project Alfa" `
    -Description "Main engineering sprint discussions and deliverables" `
    -MembershipType Standard

# 2. Create a Private Channel (Requires specifying an existing Team Owner via -Owner)
New-TeamChannel -GroupId $GroupId `
    -DisplayName "Project Alfa - Budget & Contracts" `
    -Description "Confidential vendor contracts and financial tracking" `
    -MembershipType Private `
    -Owner "[email protected]"

# 3. Create a Shared Channel
New-TeamChannel -GroupId $GroupId `
    -DisplayName "Project Alfa - External Partner Sync" `
    -MembershipType Shared `
    -Owner "[email protected]"

3. Add-TeamUser: Add Owners and Members to a Team (or Private Channel)

With Add-TeamUser, you can add users as a Member (default) or Owner, and even scope membership to a specific Private Channel using -DisplayName:

POWERSHELL
$GroupId = "255d4a49-5076-42c8-a109-45252a7244a7"

# 1. Add a regular Member to the Team
Add-TeamUser -GroupId $GroupId -User "[email protected]" -Role Member

# 2. Promote or add a secondary Team Owner (Always maintain at least 2 Owners per Team!)
Add-TeamUser -GroupId $GroupId -User "[email protected]" -Role Owner

# 3. Add a Team Member into a specific Private Channel
Add-TeamUser -GroupId $GroupId `
    -DisplayName "Project Alfa - Budget & Contracts" `
    -User "[email protected]"

# 4. Bulk Onboard Users from a CSV File (Columns: UPN, Role)
Import-Csv "C:\Temp\ProjectAlfaRoster.csv" | ForEach-Object {
    Add-TeamUser -GroupId $GroupId -User $_.UPN -Role $_.Role
    Write-Host "[+] Added $($_.UPN) as $($_.Role)" -ForegroundColor Cyan
}

4. Remove-TeamChannel: Delete a Channel from a Team

When a workstream concludes, remove the channel using Remove-TeamChannel (note that the default General channel cannot be deleted):

POWERSHELL
$GroupId = "255d4a49-5076-42c8-a109-45252a7244a7"

Remove-TeamChannel -GroupId $GroupId -DisplayName "Project Alfa"

Deleted channels enter a 30-day soft-delete retention window during which they can be restored in the Teams Admin Center or client UI.


5. Remove-TeamUser: Remove a Member, Guest, or Owner from a Team

To offboard a user or revoke guest access from a specific Team, run Remove-TeamUser:

POWERSHELL
$GroupId = "255d4a49-5076-42c8-a109-45252a7244a7"

# Remove a user from the entire Team
Remove-TeamUser -GroupId $GroupId -User "[email protected]"

# Or remove a user strictly from a Private Channel while keeping them in the parent Team
Remove-TeamUser -GroupId $GroupId `
    -DisplayName "Project Alfa - Budget & Contracts" `
    -User "[email protected]"

6. Set-TeamArchivedState vs. Remove-Team: Safely Decommissioning a Team

Before running Remove-Team, decide whether you want to Archive (freeze) the Team or Delete it:

Archiving freezes all channel conversations and optionally makes the backing SharePoint site read-only for members while preserving all compliance data:

POWERSHELL
Set-TeamArchivedState -GroupId "255d4a49-5076-42c8-a109-45252a7244a7" `
    -Archived $true `
    -SetSpoSiteReadOnlyForMembers $true

Option B: Delete the Team (Remove-Team)

If the Team was created for testing or is no longer needed, delete it via Remove-Team:

POWERSHELL
Remove-Team -GroupId "255d4a49-5076-42c8-a109-45252a7244a7"
Accidentally ran Remove-Team on a production Team? Don't panic! Remove-Team moves the underlying Microsoft 365 Unified Group into the Entra ID 30-day soft-deleted recycle bin. Follow our emergency recovery runbook—How to Restore Deleted Microsoft 365 Groups and Microsoft Teams via PowerShell—to restore the Team, its channels, and its SharePoint files completely intact.

Complete Microsoft Teams PowerShell Series Index