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
- Preparing an on-premise a new fresh Domain Controller with Targetdomain.com.
- Creating the users accounts in Targetdomain.com.
- Configuring Local DNS and pointing MX records to M365 targetdomain.com.
- AD DS synchronization between on-premise Active Directory and Office 365 target portal using Azure AD Connect tool.
Phase 2
- Stopping the AD DS Synchronization during the migration phase between on-premise AD and M365 for both sourcedomain.com and targetdomain.com
- 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.
- 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)
- 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
- 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.
- Testing that the administrator can access user mailboxes.
- Activating the office licenses for the Office 365 users and enabling Mailboxes at the Target Portal.
- 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
- At the target, the Administrator must have full access to the user mailboxes.
- Testing that the administrator can access user mailboxes
- Once the migration of all the mailboxes is completed:
-
- 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.
- Make sure sourcedomain.com is added as an accepted domain in Target Portal.
-
- 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.
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
-
-
- In the admin center, go to the Settings > Domains page.
- On the Domains page, select the domain that you want to remove.
- In the right pane, select Remove.
- 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.