Unable to Migrate User to O365 – “Target user already has a primary mailbox”

If you run into an issue where a user has both a mailbox in Exchange on-premise and O365, and you cannot migrate the account to O365.

Error: “Target user already has a primary mailbox”

FIX:

Remove the O365 account and then do a full DirSync.  Once done, migrate the on-prem mailbox to O365.

    1. Open PowerShell in Connect-MSOLService -Credential $adminCredential   (enter ADAuser@company.com credentials) 
  1. remove-MSOLUser -UserPrincipalName USER@company.com 

Confirm

Continue with this operation?

[Y] Yes  [N] No  [S] Suspend  [?] Help (default is “Y”): y

  1. remove-MSOLUser -UserPrincipalName USER@company.com -RemoveFromRecycleBin 

Confirm

Continue with this operation?

[Y] Yes  [N] No  [S] Suspend  [?] Help (default is “Y”): y

**Run a Full DirSync, once completed then try to migrate the user to O365 again.