Users have two mailboxes, one online and one on-premise
While working with an Exchange hybrid environment (Exchange 2016 on-premise and Exchange Online) it became apparent that some users had two mailboxes; one on-premise and one in Exchange Online. Their primary mailbox was in the on-premise environment, the one online was empty and unused.
There are several issues with this. Firstly, it will cause issues with migration when the time comes – how can a user have 2 mailboxes? Secondly, other Office 365 services were using the wrong mailbox (for example, Teams was showing an empty calendar for these users as it was not looking at the one-premise mailbox).
I had a support case open with Microsoft for over 3 months and they couldn’t resolve it without completely deleting the user account in Office 365. If it was a new user that wouldn’t be a problem, but these users have been around for years and have so much data in Teams, SharePoint, Dynamics, etc – that would have been a huge admin overhead to restore.
Eventually I came across a PowerShell command that solved the issue by permanently removing all Exchange Online data. These are the steps I took to resolve it, but proceed with caution as you need to understand whether the users have anything of any value in Exchange Online:
- Disable the Exchange Online license for the affected user
- Run the following PowerShell cmdlet once connected to Exchange Online PowerShell:
Set-User firstname.lastname@example.org -PermanentlyClearPreviousMailboxInfo
- Wait for the on-premise AD to sync with Azure AD or force a sync on the server running AADC:
Start-ADSyncSyncCycle -PolicyType Delta
- Enable the Exchange Online license for the user
Now the user only has one mailbox, enabling the license does not create a second mailbox.