Had an issue today where a customer was mid migration to Office 365. All their mailboxes were on-premise but they changed their MX records for mail delivery to Microsoft. The customer found that for a handful of users they stopped receiving mail to their on-premise mailbox. When i investigated I found that the users affected had mailboxes in Office 365. When logged into the Office 365 portal I could see the users listed. The users also knew their passwords for their 365 accounts. It turned out that these users were created in 365 prior to the migration for testing purposes. Then when dirsync had run the users then had 2 accounts. One on-premise and one in 365. To rectify the problem I carried out the following steps.
1) Backed Up any emails needed from Office 365 mailboxes.
2) Connected to Office 365 via PowerShell – Please see previous article here
3) Find the user by running the command :
Get-MsolUser -SearchString FirstNameOfUser
4) This will list the User Principle Name for each User returned above. For the one you want to delete run :-
Remove-MsolUser -UserPrincipalName [email protected]
5) Then you want to remove this user from the recycle bin.
Remove-MsolUser -UserPrincipalName [email protected] -RemoveFromRecycleBin
6) Now force a dirsync replication and you will all be good.