During a Office 365 migration on a Hybrid environment with AAD Connectran in to the following scenario:
- Hybrid Co-Existence Environment with AAD-Sync
- User [email protected] has a mailbox on-premises. Jon is represented as a Mail User in the cloud with a office 365 license
- [email protected] had a cloud only mailbox prior to the initial AD-sync was run
- User account is registered as a mail-user and has a valid license attached
- During the office 365 Remote mailbox move we end up with the following error during validation and removing the immutable ID and remapping to on premise account wont fix the issue
Target user 'Sam fisher' already has a primary mailbox.
+ CategoryInfo : InvalidArgument: (tsu:MailboxOrMailUserIdParameter) [New-MoveRequest], RecipientTaskException
+ FullyQualifiedErrorId : [Server=Pl-EX001,RequestId=19e90208-e39d-42bc-bde3-ee0db6375b8a,TimeStamp=11/6/2019 4:10:43 PM] [FailureCategory=Cmdlet-RecipientTaskException] 9418C1E1,Microsoft.Exchange.Management.Migration.MailboxRep
+ PSComputerName : Pl-ex001.Paladin.org
It turns out this happens due to an unclean cloud object on MSOL, This is because Exchange online keeps pointers that indicate that there used to be a mailbox in the cloud for this user
Option 1 (nuclear option)
to fix this problem was to delete *MSOL User Object* for Sam and re-sync it from on-premises. This would delete [email protected] from the cloud – but it will delete him/her from all workloads, not only Exchange. This is problematic because Sam is already using Teams, One-drive, SharePoint.
Clean up only the office 365 mailbox pointer information
PS C:\> Set-User [email protected] -PermanentlyClearPreviousMailboxInfo
Are you sure you want to perform this action?
Delete all existing information about user "[email protected]"?. This operation will clear existing values from
Previous home MDB and Previous Mailbox GUID of the user. After deletion, reconnecting to the previous mailbox that
existed in the cloud will not be possible and any content it had will be unrecoverable PERMANENTLY. Do you want to
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is "Y"): a
Executing this leaves you with a clean object that can be re-licensed without causing the duplicate-mailbox problem,
in my case the license was reapplied via the group based licensing and i was able to initiate the mailbox move shortly with no issues