Have you been assigned with migrating a limited number of users from one Exchange tenant to another and limited to not using tools that come with licensing costs? Or are you simply interested in a no-cost straight forward process to migrate a few mailboxes tenant to tenant? We might just have the thing for you!
This migration process is using exclusively out of the box tools and covers the following scenarios:
- Migration of the email accounts to a new tenant with a new domain
- The domain used in the old tenant cannot be added to the new tenant as a secondary domain. If you can add the old domain as secondary domain in the new tenant then start with step 4 and add the old email address as an alias to the new account.
Please bear in mind that the outlined procedure is not appropriate for migrating a large number of mailboxes, as it is laborious and time-intensive.
The process consists of the following steps:
- Set the Transport rule
- Set the Auto forwarding rule
- Set Auto Reply
- Block the O365 account
- PST Export
- PST Import
- Verify statistics
Now let us dive deeper into each of the steps:
Set the Transport rule
This step is needed to stop looping the emails
New-TransportRule -From email@example.com -SentTo firstname.lastname@example.org -DeleteMessage:$true -Name "Stop auto-forwarding from <User>"-SenderAddressLocation ‘Header’
Get-TransportRule "Stop auto-forwarding from <User>" |ft
Write-Host "Transport rule created for <User>" -ForegroundColor "yellow";
Set the Auto forwarding rule
Needed to forward the emails from the old account to the newly created one:
Set-mailbox "email@example.com" -ForwardingSmtpAddress "firstname.lastname@example.org" -DeliverToMailboxAndForward $true
Get-Mailbox -Identity "email@example.com" | fl *forward*
Set autoreply rules
This step is a great way to ensure the sender becomes aware of the decommissioning of the old address and the user’s new address:
Set-MailboxAutoReplyConfiguration -Identity firstname.lastname@example.org -AutoReplyState Enabled -InternalMessage " Autoreply message text "
Block the O365 account
Lock the old account in Active Directory on-premises.
We will export the PST using Outlook. You can do it directly with the end user or you can grant yourself access to the mailbox and export it:
- Go to EXO Admin Center -> recipients -> choose the account to migrate -> edit
- Under Full Access, add the Admin_Mgr account
- If you were recently granted access to the mailbox, it may take a few hours for the other user’s mailbox to display in your folder list.
Change the cache mode:
- Open the Admin_Mgr profile on Outlook
Outlook -> File -> Account Settings -> Account settings
- Double click on the Outlook account
Use Cache Exchange Mode should not be ticked – this will reassure you that you export all the email content.
- Restart Outlook
- Go to Outlook -> File -> Open & Export ->Import/Export -> Export to a File -> Outlook Data file (pst) -> Select the entire user mailbox that you want to export
- Save the exported file to folder Desktop/Backup Migration _ Username/backup.pst
- Select Do not export duplicates -> Finish
Important: Before starting the import check the destination language of the email profile to be the same with the one from source. If it is not the case, the email folder import will not match because of the different naming.
Get-MailboxRegionalConfiguration -id emailaddress | ft Identity, language
Once you align the languages, you can move forward with the import.
Upload your PST files to Office 365
- Go to https://protection.office.com and sign in using the credentials for an administrator account in your Office 365 organization.
- In the left pane of the Security & Compliance Center, click Data governance > Import.
On the Import page, click New import job.
- The import wizard is displayed
Type a name for the PST import job, and then click Next. Use lowercase letters, numbers, hyphens, and underscores. You must not use uppercase letters or include spaces in the name.
- On the Do you want to upload or ship data? page, click Upload your data and then click Next.
On the Import data page, do the following two things:
- click Show network upload SAS URL. After the SAS URL is displayed, click Copy to clipboard and then paste it and save it to a file so you can access it later.
- click Download Azure AzCopy to download and install the Azure AzCopy tool. As previously stated, version 8.1.0 will be downloaded. In the pop-up window, click Run to install AzCopy.
- Install AzCopy from: Transfer data with the AzCopy on Windows. (Alternate download v8.1.0: MicrosoftAzureStorageAzCopy_netcore_x64)
- Open a Command Prompt on your local computer.
- Go to the directory where you installed the AzCopy.exe tool in step 6.h. If you installed the tool in the default location, go to %ProgramFiles(x86)%\Microsoft SDKs\Azure\AzCopy.
Run the following command to upload the PST files to Office 365:
AzCopy.exe /Source:"<Location of PST files>" /Dest:"<SAS URL>" /V:"<Log file location>" /Y
C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy>AzCopy.exe /Source:"C:\Users\BogdanCoamesu\Downloads\pstpath" /Dest:"https://GUID" /V:"C:\Users\BogdanCoamesu\Downloads\pstpath\az.log" /Y
Once uploaded, create the PST mapping file:
Important: It is mandatory to use the USER GUID from AAD instead of mailbox. If you put the mailbox the import will not be executed correctly, you will generate folder duplicates and inconsistencies.
In order to get the USER GUID, access: https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Overview
Click on Users -> Click on the Name of the user and get the Object ID
Continue from step 6.g and start the import job.
Using this step, you can compare the information about the number and size of items in the folders between source and destination.
Use the Get-MailboxFolderStatistics cmdlet to retrieve information about the folders in a specified mailbox, including the number and size of items in the folder, the folder name and ID, and other information.
Get-MailboxFolderStatistics -Identity <mailbox> | select Name, FolderSize, ItemsinFolder, VisibleItemsInFolder, HiddenItemsinFolder, Itemsinfolderandsubfolders | export-csv "C:\Users\BC\Documents\Migration\mailbox_migration.csv"
Tip: Check the VisibleItemsInFolder column to match. The other ones might defer can be due to the backend tables and no impact on the user.
All in all, there are lots of steps to follow and the process can be lengthy for larger mailboxes, but if you are looking to migrate just a few mailboxes and want to not involve 3rd party tools, this procedure might be just the thing for you. Hope this was helpful!