Home » Microsoft Teams » Migrate Microsoft Teams from One Tenant to Another – Learn How
Microsoft Teams ~ 8 Minutes Reading

Migrate Microsoft Teams from One Tenant to Another – Learn How

author
Published By Aldrich Calvin
Anuraag Singh
Approved By Anuraag Singh
Calendar
Published On May 21st, 2024

Various users around the world are looking for a way to migrate Microsoft Teams from one tenant to another. The migration needs to be quick and safe since a lot of sensitive information such as chats, attachments, etc. is present.

Therefore, we are here with the most secure and quickest way to perform this type of migration. But before that, what is the need for Microsoft Teams? And why is there a need for migration? Microsoft Teams allows users to chat with employees, clients, etc. It also provides the benefits of file sharing, audio-video sharing, & real-time collaboration. This is why organizations have been moving to Teams at large. The need for teams migration from one tenant to another arises when a project ends and another project starts.

There are cases where a new project starts & an ongoing project is given to someone else. Only then the users want to perform the migration.

Migrate Microsoft Teams from One Tenant to Another – Why is it Such a Challenge?

Before we begin the process to Migrate Microsoft Teams from One Tenant to Another, we will discuss the main source of the issue. It is that the majority of Teams data is really stored in these other sites rather than in Teams itself:

  1. SharePoint team site: Documents and folders exchanged in a channel or kept in the team document library; external emails forwarded to the team; the team wiki page; and OneNote assets specific to each channel.
  2. Exchange team mailbox: contacts, team mail, and conversation history from group and channel chats. Individual user exchange
  3. Mailboxes: voicemails, scheduled meetings, and the history of private 1:1 chat conversations.
  4. Individual users’ OneDrive for Business accounts: Files exchanged during private chat sessions, meetings, or phone calls are uploaded and saved in the OneDrive account of the sharing user.
  5. Organisational document library on OneDrive: Individual OneNote of users. 
  6. Azure (using Blob storage): Media and images shared in conversations, excluding GIFs.
  7. Stream: Recordings from meetings.
  8. Third-party storage provider: Data that users are able to store on a third-party storage provider through tabs or other partner apps is stored directly in the partner’s system if your business permits users to do so.

Because Microsoft does not provide publicly accessible APIs, it is not viable to automatically transfer Teams using Microsoft’s out-of-the-box solutions.

How to Manually Migrate?

Users must perform numerous procedures and a great deal of difficult work in order to migrate Microsoft Teams data to a different tenant manually.

Technically, moving Microsoft Teams between Microsoft 365 tenants is not possible with a simple, built-in solution. However, some of the fundamental elements are transferable, like the files on the corresponding team SharePoint site and the group chat and channel conversation history kept in the team Exchange mailbox.

There are several approaches you may take to accomplish this, but we’ll take you through one of the easiest ones that doesn’t require any outside software.

In order to migrate your Microsoft Teams from one tenant to another manually, you need to do the following:

  1. Re-create the Teams that you want at the destination. 
  2. Ensure that all the permissions and users are configured to your requirements.
  3. The contents of the related SharePoint team sites should be downloaded and uploaded to the desired location.
  4. Conversations can be exported from the group’s Exchange mailbox and then imported as a document at the destination.

Re-create the Teams that you want at the destination – 

In order for your files to have a destination, you must first create your new Teams environment before copying any Teams content.

This means that you have to re-create the structure of your source Teams including all the channels and tabs within each Teams.

Add all the correct users and permissions to all the Teams.

Once you have set up the Teams Environment, you are required to populate it with all your files and data from your source Teams. This means adding all the users and permissions to each Team. 

Now, you should have already added all the users at the destination Azure Active Directory which means that you are inviting users to join the same Teams that they were a member of in the old environment.  

In order to invite bulk users to Microsoft Teams, you need to do the following: 

  1. Insert all the permissions and users in a CSV file. 
  2. Modify all the domains that are in association with each other. 
  3. Now, you can add all the users from the CSV file to the destination team.
  4. Modify the permissions as per your requirements.

How to Extract Permissions and Users to a CSV File?

You need to first generate a list of details about your existing teams. To export all the details about your teams, you will need to run this script: 

function Export- INSERT YOUR TEAM LIST HERE

{  

     param (  

           $ExportPath

           )  

    process{

                Connect-PnPOnline -Scopes “Group.Read.All”,”User.ReadBasic.All”

                $accesstoken =Get-PnPAccessToken

                $MTeams = Invoke-RestMethod -Headers @{Authorization = “Bearer $accesstoken”} -Uri  “https://graph.microsoft.com/beta/groups?`$filter=resourceProvisioningOptions/any(c:c+eq+`’Team`’)” -Method Get

                $TeamsList = @()

                $i=1

                do

                {

                    foreach($value in $MTeams.value)

                    {        

                  

                            $id= $value.id

                            Try

                            {

                           $team = Invoke-RestMethod -Headers @{Authorization = “Bearer $accesstoken”} -Uri https://graph.microsoft.com/beta/teams/$id/channels -Method Get

                                

                            }

                            Catch

                            {

                               

                            }                 

                

                            $Owner = Invoke-RestMethod -Headers @{Authorization = “Bearer $accesstoken”} -Uri https://graph.microsoft.com/v1.0/Groups/$id/owners -Method Get

                            $Members = Invoke-RestMethod -Headers @{Authorization = “Bearer $accesstoken”} -Uri https://graph.microsoft.com/v1.0/Groups/$id/Members -Method Get

                            $Teams = “” | Select “TeamsName”,”TeamType”,”Channelcount”,”ChannelName”,”Owners”,”MembersCount”,”Members”

                            $Teams.TeamsName = $value.displayname

                            $Teams.TeamType = $value.visibility

                            $Teams.ChannelCount = $team.value.id.count

                            $Teams.ChannelName = $team.value.displayName -join “;”

                            $Teams.Owners = $Owner.value.userPrincipalName -join “;”

                            $Teams.MembersCount = $Members.value.userPrincipalName.count

                            $Teams.Members = $Members.value.userPrincipalName -join “;”

                            $TeamsList+= $Teams

                            $teamaccesstype=$null

                            $errorMessage =$null

                            $Teams=$null

                            $team =$null

                            $i++

                    }

                    if ($MTeams.’@odata.nextLink’ -eq $null )

                    {

                        break

                    }

                    else

                    {

                        $MTeams = Invoke-RestMethod -Headers @{Authorization = “INSERT Bearer $accesstoken”} -Uri $MTeams.’@odata.nextLink’ -Method Get

                    }

                }while($true);

                $TeamsList.count

                $TeamsList

                $TeamsList | Export-csv $ExportPath -NoTypeInformation

            }

}

Export-TeamsList -ExportPath “C:\temp\teamswithmembers.csv”

Note: You have to install the SharePoint Online PnP PowerShell module to run this script.

The CSV file that is the output of this script will give you the following information: 

  1. Your Team name.
  2. The type of Team you have.
  3. Number of channels in your Team. 
  4. The name and owner of the Team.
  5. Number of members in a Team.

Modify the Domains Connected with all the Users.

To map the existing Team membership at the destination, you would have to change the old name of the domain to the new domain name in the CSV file. Change the older domain name to the destination domain name. 

Note: This will only work if the usernames are left unchanged. 

After modifying the CSV file, you will need to upload the users to the destination Team.

You can connect your Microsoft Teams by running this command: 

Connect-MicrosoftTeams

Sign in with your account details and once you are connected, you can run the following command to get a list of your teams. 

Get-Team

This method will allow you to add users in bulk to the CSV file. Now, go to your CVS file and do the following: 

  1. Copy the emails of the user for a Team. 
  2. Create a CSV file and put all the emails of the users in a column. Save it as a CSV file. 
  3. Repeat this process for all the Teams. 

Now you can run the following command to get all of the users to join the new Team: 

Import-Csv -Path “YOUR_FILE_PATH” | foreach{Add-TeamUser -GroupId YOUR_TEAM_ID -user $_.email}

When this script has run correctly, you will be able to see all the users added to their corresponding teams. You can now promote the appropriate members of the Team as the owner. 

How to Download and Upload SharePoint Team Sites to the Desired Location?

The next step is to copy the contents of the teams to your destination. All of the content stored is in the SharePoint of the team. 

Since we are performing a migration between tenants, the built-in feature of Copying and Moving in SharePoint would not work as it only works with files that need to be moved between teams in the same tenant. 

In order to shift your data from one tenant to the other, you would have to download them from the source and then upload them to the destination. 

Since the general folder stores all the contents of the files tab, at the very least you can download and upload it to get the users started in the new tenant. 

To do this simply select the contents of the general folder and click on the download option. 

Once the files are downloaded, you can go to the general folder in the new Teams and upload the files there. 

Note: You will lose all the metadata associated with your files by performing the process mentioned above. 

Conclusion

Migrating Microsoft Teams from one tenant to another is a complex process. While Microsoft does not offer an out-of-the-box solution for this migration, understanding the complexities involved and following a detailed manual can help ensure a smooth transition. In this article, we have discussed the manual method you need to follow to easily carry out the migration process.