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:

Now let us dive deeper into each of the steps:

  1. Set the Transport rule

    This step is needed to stop looping the emails

    [code language=”shell”]
    New-TransportRule -From new_mailbox@new.domain.com -SentTo old_mailbox@old.domain.com -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";
    [/code]

  2. Set the Auto forwarding rule

    Needed to forward the emails from the old account to the newly created one:

    [code language=”shell”]
    Set-mailbox "old_mailbox@old.domain.com" -ForwardingSmtpAddress "new_mailbox@new.domain.com" -DeliverToMailboxAndForward $true
    Get-Mailbox -Identity "old_mailbox@old.domain.com" | fl *forward*
    [/code]

  3. 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:

    [code language=”shell”]
    Set-MailboxAutoReplyConfiguration -Identity old_mailbox@old.domain.com -AutoReplyState Enabled -InternalMessage " Autoreply message text "
    [/code]

  4. Block the O365 account

    Lock the old account in Active Directory on-premises.

  5. PST Export

    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:

    1. Go to EXO Admin Center -> recipients -> choose the account to migrate -> edit
    2. 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:

    1. Open the Admin_Mgr profile on Outlook
    2. Outlook -> File -> Account Settings -> Account settings
    3. Double click on the Outlook account
    4. Use Cache Exchange Mode should not be ticked – this will reassure you that you export all the email content.
    5. Restart Outlook
    6. 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
    7. Save the exported file to folder Desktop/Backup Migration _ Username/backup.pst
    8. Select Do not export duplicates -> Finish
  6. PST Import

    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.

    [code language=”shell”]
    Get-MailboxRegionalConfiguration -id emailaddress | ft Identity, language
    [/code]

    Once you align the languages, you can move forward with the import.

    Upload your PST files to Office 365

    1. Go to https://protection.office.com and sign in using the credentials for an administrator account in your Office 365 organization.
    2. In the left pane of the Security & Compliance Center, click Data governance > Import.
    3. On the Import page, click New import job.
    4. The import wizard is displayed
    5. 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.
    6. On the Do you want to upload or ship data? page, click Upload your data and then click Next.
    7. On the Import data page, do the following two things:

      1. 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.
      2. 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.
    8. Install AzCopy from: Transfer data with the AzCopy on Windows. (Alternate download v8.1.0: MicrosoftAzureStorageAzCopy_netcore_x64)
    9. Open a Command Prompt on your local computer.
    10. 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.
    11. Run the following command to upload the PST files to Office 365:
      [code language=”shell”]
      AzCopy.exe /Source:"<Location of PST files>" /Dest:"<SAS URL>" /V:"<Log file location>" /Y

      Ex:
      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
      [/code]

      Reference: Use network upload to import your organization PST files to Office 365

    12. Once uploaded, create the PST mapping file:
      [code language=”shell”]
      Workload,FilePath,Name,Mailbox,IsArchive,TargetRootFolder,SPFileContainer,SPManifestContainer,SPSiteUrl
      Exchange,,email_backp.pst,abdeg12345321234332532522,FALSE,/,,,
      [/code]

    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.

  7. Verify statistics

    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.

    [code language=”shell”]
    Get-MailboxFolderStatistics -Identity <mailbox> | select Name, FolderSize, ItemsinFolder, VisibleItemsInFolder, HiddenItemsinFolder, Itemsinfolderandsubfolders | export-csv "C:\Users\BC\Documents\Migration\mailbox_migration.csv"
    [/code]

    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!