Office 365 - Rename Microsoft Teams using PowerShell (group name, email address and SharePoint site)
How to rename a Microsoft Team using PowerShell. Change the Teams display name and description, change Teams email addresses and rename the Teams SharePoint site.
What resources are included with a Team?
- Microsoft 365 group
- Exchange online mailbox
- SharePoint online site
Steps to rename a Microsoft Team
- Install prerequisites
- Change Teams display name and description
- Change Teams email addresses
- Rename Teams SharePoint site
1. Install prerequisites
Install the following PowerShell modules and set the execution policy
# Change PowerShell execution policy to RemoteSigned Set-ExecutionPolicy RemoteSigned # Install NuGet Install-PackageProvider -Name NuGet -Force # Install Teams PowerShell Module Install-Module -Name PowerShellGet -Force -AllowClobber Install-Module -Name MicrosoftTeams -Force -AllowClobber # Install Exchange online PowerShell module Install-Module -Name ExchangeOnlineManagement # Install SharePoint online PowerShell module Install-Module -Name Microsoft.Online.SharePoint.PowerShell
2. Change Teams display name and description
In this example, we are renaming the "London Sales" Team to "UK Sales"
Rename the Team using PowerShell Set-Team
# Connect to Teams online Connect-MicrosoftTeams # Define Team names $OldTeamName = "London Sales" $NewTeamName = "UK Sales" # Get Team Group ID $Group = Get-Team -DisplayName $OldTeamName | select GroupId # Change Team display name and description Set-Team -Group $Group.GroupId -DisplayName $NewTeamName -Description "$NewTeamName Team"
Check the new Team display name and description
# Get Team display name and description Get-Team -DisplayName $NewTeamName | Select DisplayName, Description | ft
3. Change Teams email addresses
Set a new Teams primary email address and change the mail aliases using Exchange online PowerShell Set-UnifiedGroup
Existing secondary smtp email addresses will not be changed when running Set-UnifiedGroup -EmailAddresses
# Connect to Exchange Online PowerShell Connect-ExchangeOnline -UserPrincipalName itadmin@yourdomain.com # Get Unified group name $UnifiedGroup = Get-UnifiedGroup -Identity "UK Sales" # Get M365 group email addresses Get-UnifiedGroup -Identity $UnifiedGroup | select DisplayName, Alias, PrimarySmtpAddress, EmailAddresses | fl $NewAlias = "uksales" # Add new email alias Set-UnifiedGroup -Identity $UnifiedGroup -EmailAddresses $NewAlias@planetxpressnet.onmicrosoft.com # Change primary smtp address Set-UnifiedGroup -Identity $UnifiedGroup -Alias $NewAlias -PrimarySmtpAddress "$NewAlias@planetxpress.net"
4. Rename Teams SharePoint site
Rename Teams SharePoint site using PowerShell Start-SPOSiteRename
Get the Teams current SharePoint site URL using Exchange Online PowerShell
# Connect to Exchange online Connect-ExchangeOnline -UserPrincipalName itadmin@yourdomain.com # Get Team SharePoint site URL Get-UnifiedGroup -Identity "UK Sales" | Select DisplayName,SharePointSiteUrl,SharepointDocumentsUrl | fl
Copy the SharePoint site URL
Rename Teams SharePoint site using PowerShell Start-SPOSiteRename
# Connect to SharePoint online Connect-SPOService -Url https://planetxpressnet-admin.sharepoint.com # Check if the SharePoint site can be renamed Start-SPOSiteRename -Identity https://planetxpressnet.sharepoint.com/sites/LondonSales -NewSiteUrl https://planetxpressnet.sharepoint.com/sites/UKSales -ValidationOnly
# Rename the Teams SharePoint site Start-SPOSiteRename -Identity https://planetxpressnet.sharepoint.com/sites/LondonSales -NewSiteUrl https://planetxpressnet.sharepoint.com/sites/UKSales
User experience
Changes will show in the Teams client without users having to sign out/sign in againWhen the Teams email address is updated, the old email address is kept as an alias, so any emails sent to the old Team will still get delivered.
References:
by Author
SharePoint Change a site address
https://docs.microsoft.com/en-us/sharepoint/change-site-address
Microsoft Teams PowerShell Set-Team
https://docs.microsoft.com/en-us/powershell/module/teams/set-team
Exchange PowerShell Set-UnifiedGroup
https://docs.microsoft.com/en-us/powershell/module/exchange/set-unifiedgroup
Comments