The Microsoft Teams PowerShell Module (MicrosoftTeams) has evolved dramatically since its initial 0.9.0 public preview in the PowerShell Gallery. Today, the modern MicrosoftTeams (v6.x+) module consolidates both Team and Channel lifecycle management (Get-Team, New-Team, Set-Team, Add-TeamUser) and Skype for Business Online / Teams Voice & Policy administration (Get-CsOnlineUser, Grant-CsTeamsMessagingPolicy, Set-CsTeamsMeetingPolicy) into a single unified package containing over 600 cmdlets.
Furthermore, with Microsoft retiring legacy basic authentication and -Credential password flows across Microsoft 365, enterprise administrators must know how to install the module cleanly in both Windows PowerShell 5.1 and PowerShell 7, deploy it to offline/air-gapped jump servers, and authenticate unattended scripts using Microsoft Entra ID Certificate-Based App-Only Authentication.
In this prerequisite guide to our 4-part Microsoft Teams PowerShell series, we walk through every installation and connection method.
Microsoft Teams PowerShell Installation & Authentication Architecture
Method 1: Online Installation from the PowerShell Gallery (Recommended)
Before installing MicrosoftTeams, ensure your session enforces TLS 1.2 and uses an updated NuGet package provider. You can install the module system-wide (-Scope AllUsers, requiring an elevated Administrator prompt) or strictly for your user profile (-Scope CurrentUser, requiring no local admin rights):
# 1. Enforce TLS 1.2 for PowerShell Gallery connections
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# 2. Install the latest MicrosoftTeams module (Windows PowerShell 5.1 or PowerShell 7)
Install-Module -Name MicrosoftTeams -Force -AllowClobber -Scope CurrentUser
# Alternative for PowerShell 7.4+ using PSResourceGet (faster, no NuGet prompt):
# Install-PSResource -Name MicrosoftTeams -Scope CurrentUser -TrustRepository
Updating an Existing MicrosoftTeams Installation
If you previously installed an older 0.9.x, 2.x, or 4.x build of the module, side-by-side versions can cause assembly load conflicts (Could not load file or assembly 'Microsoft.Identity.Client'). Cleanly remove older versions and install the latest release:
# Check all installed versions of MicrosoftTeams
Get-InstalledModule -Name MicrosoftTeams -AllVersions
# Update to the latest version and purge older side-by-side releases
Update-Module -Name MicrosoftTeams -Force
Method 2: Offline Installation for Air-Gapped Management Servers (Save-Module)
If your enterprise automation server or bastion host does not have direct outbound internet access to powershellgallery.com, download the module package on an internet-connected workstation using Save-Module and copy it across your internal network:
# Run on an Internet-Connected Workstation: Download the latest MicrosoftTeams module to a local folder
New-Item -Path "C:\TeamsModuleOffline" -ItemType Directory -Force | Out-Null
Save-Module -Name MicrosoftTeams -Path "C:\TeamsModuleOffline" -Repository PSGallery
# Copy the downloaded folder to the offline server's PowerShell Modules directory:
# Windows PowerShell 5.1: C:\Program Files\WindowsPowerShell\Modules\
# PowerShell 7: C:\Program Files\PowerShell\7\Modules\
Copy-Item -Path "C:\TeamsModuleOffline\MicrosoftTeams" `
-Destination "\\JumpServer01\c$\Program Files\WindowsPowerShell\Modules\MicrosoftTeams" -Recurse -Force
Step 3: Import the Module & Inspect Exported Cmdlets
Once installed, import the module into your session and inspect the available commands:
Import-Module MicrosoftTeams
# Verify module version and total exported cmdlet count
$Mod = Get-Module MicrosoftTeams
Write-Host "Loaded MicrosoftTeams Version: $($Mod.Version) | Total Cmdlets: $($Mod.ExportedCommands.Count)" -ForegroundColor Cyan
# List core Team & Channel lifecycle cmdlets (excluding Cs* voice policy cmdlets)
Get-Command -Module MicrosoftTeams -Noun Team* | Select-Object Name, CommandType | Format-Table -AutoSize
Step 4: Connect to Microsoft Teams (Connect-MicrosoftTeams)
Option A: Interactive Admin Sign-In (Supports MFA, Passkeys & Conditional Access)
For ad-hoc administrative tasks, run Connect-MicrosoftTeams with no parameters to trigger the modern browser/WAM authentication prompt:
# Interactive login with MFA / FIDO2 Passkey support
Connect-MicrosoftTeams
Deprecation Warning: Never pass-Credential (Get-Credential)toConnect-MicrosoftTeamsin modern tenants—ROPC (username/password) authentication fails whenever MFA, Conditional Access, or Security Defaults are enabled.
Option B: Unattended Certificate-Based App-Only Authentication (For Scheduled Scripts)
To run unattended Microsoft Teams PowerShell scripts in Task Scheduler or Azure Automation, use an Entra ID App Registration configured with:
- A local X.509 certificate (
Cert:\CurrentUser\My\<Thumbprint>). - Microsoft Graph Application Permissions:
Organization.Read.All,User.Read.All,Group.ReadWrite.All,AppCatalog.ReadWrite.All,TeamSettings.ReadWrite.All,Channel.Delete.All,ChannelSettings.ReadWrite.All,ChannelMember.ReadWrite.All. - The Teams Administrator Entra ID directory role assigned to the Service Principal (required if running
-Cspolicy cmdlets).
# Unattended Certificate-Based App-Only Connection (Verified on LAB 365 Dev Tenant)
$TenantId = "ab85c7a1-366d-44ba-acc6-924fa0950045"
$ClientId = "c841ae33-4093-4385-8a90-6a530761f9b9"
$CertThumbprint = "BEAC429DE404B46FF030811C0C9DE00DE701C027"
Connect-MicrosoftTeams -ApplicationId $ClientId `
-TenantId $TenantId `
-CertificateThumbprint $CertThumbprint
# Verify connection by listing Teams in the tenant
Get-Team | Select-Object -First 5 GroupId, DisplayName, Visibility, Archived
Continue the Microsoft Teams PowerShell Series
Now that you have the MicrosoftTeams module installed and connected, explore our complete 3-part operational command reference: