3 minutes reading time (597 words)

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?

When you create a Team, these Office 365 resources are also created:
  • Microsoft 365 group
  • Exchange online mailbox
  • SharePoint online site

Steps to rename a Microsoft Team

To properly rename a Team you'll need to change the display name, email addresses and SharePoint site name

  1. Install prerequisites
  2. Change Teams display name and description
  3. Change Teams email addresses
  4. 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

# 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

# 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.

Related Posts



No comments made yet. Be the first to submit a comment
Already Registered? Login Here
Saturday, 23 September 2023
You can help support this website by buying me a coffee!
Buy Me A Coffee