Motivation: Making the Systems Engineers life easier.

Blog

Migrating M365 (Office 365) from one tenant to another tenant with a domain name change.

M365 (Office 365)

Migrating M365 (Office 365) from one tenant to another tenant with a domain name change.

Recently I have migrated an M365 (Formerly office 365) Tenant to another M365 Tenant portal with a Domain Name change and the customer also wanted to keep the source domain for receiving emails. Additionally, customer wanted to the use a new Active Directory on-premise to synchronize users with M365 using AD Connect.

This migration plan will also consists of a Third Party Migration Tool, as currently Microsoft does not support built-in tenant-to-tenant migration.

Source: sourcedomain.com & Target: targetdomain.com

Migration approach was been divided into Two Phases:

Phase 1

  1. Preparing an on-premise a new fresh Domain Controller with Targetdomain.com.
  2. Creating the users accounts in Targetdomain.com.
  3. Configuring Local DNS and pointing MX records to M365 targetdomain.com.
  4. AD DS synchronization between on-premise Active Directory and Office 365 target portal using Azure AD Connect tool.

 

Phase 2

  1. Stopping the AD DS Synchronization during the migration phase between on-premise AD and M365 for both sourcedomain.com and targetdomain.com
  2. Preparing the Third Party tool for Source and Target migration. It depends which third party tool is being used for the migration. So accordingly you need to follow the steps.
    1. Once the mailboxes are migrated (usually all the emails copied from source amir@sourcedomain.com à amir@targetdomain.com target and not completely moved or migrated)
    2. At the source, administrator account in Office 365 will be used for migration. The administrator account should be licensed and should be mailbox enabled. The Admin account looks like this admin@tenantname.onmicrosoft.com
    3. At Source, adding tenantname.onmicrosoft.com account to each mailbox in Office 365 or it already exists, because you will have to remove the sourcedomain.com from the all the mailboxes from source.
    4. Testing that the administrator can access user mailboxes.
    5. Activating the office licenses for the Office 365 users and enabling Mailboxes at the Target Portal.
    6. At the target, administrator account in Office 365 will be used for migration. The administrator account should be licensed and should be mailbox enabled. The Admin account looks like this admin@tenantname.onmicrosoft.com
    7. At the target, the Administrator must have full access to the user mailboxes.
    8. Testing that the administrator can access user mailboxes
  3. Once the migration of all the mailboxes is completed:
      1. Add the domain (sourcedomain.com) to the Target Portal. You will have to add a TXT record in the domain hosting portal to show that you own the domain. But the MX records are still pointing to the old portal.
      2. Make sure sourcedomain.com is added as an accepted domain in Target Portal.
  4. Adding the aliases to the mailboxes in target portal via On premise Active Directory, by running the following script format:

C:\get-aduser -filter * -SearchBase “OU=IT,DC=sourcedomnain,DC=com” -Properties ProxyAddresses | select Name, ProxyAddresses

Run the below command to add the additional alias:

C:\Import-Csv “C:\Temp\importsourcesmtp.csv” | foreach {Set-ADUser -Identity $_.samaccountname -add @{Proxyaddresses=$_.Proxyaddresses -split “,”}}

CSV file looks like this:

If there is no integration between On-premise AD and M365 for User synchronization, the follow the below solution for creating users in M365:

On the elevated Windows PowerShell followed the below article by Paul Cunningham and added additional aliases.

https://practical365.com/exchange-server/add-smtpaddresses-ps1-bulk-add-smtp-addresses-to-office-365-mailbox-users/

Command I run:

PS C:\.\Add-SMTPAddresses.ps1 -Domain sourcedomain.com -MakePrimary -Commit

Add-SMTPAddresses.ps1 can be downloaded from the TechNet Script Gallery or Github. If you have any feedback or issues please leave a comment below or raise an issue on Github.

5. Removed the source domain from M365 portal

      1. In the admin center, go to the Settings > Domains page.
      2. On the Domains page, select the domain that you want to remove.
      3. In the right pane, select Remove.
      4. Follow any additional prompts, and then select Close.

Usually during Domain Removal it prompts that domain is in use and it cannot be removed, but the current M365 portal gives a notification at the time of domain removal saying that it will also be removing all the attributes from the users mailboxes and groups during the domain removal, accept it and close.

6. Change the MX Records for sourcedomain.com in the domain hosting panel.

Users will start receiving in their new mailboxes and primary SMTP is targetdomain.com and alias is sourcedomain.com.

Outlook profiles can be configured with the new email address.

 

Leave your thought here

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Archives