During a recent move from on-premise Exchange to Office 365, I ran into an issue with enabling an Exchange online mailbox via Powershell for a user that already existed within on premise AD.
ExchangeGuid is mandatory on UserMailbox.
Database is mandatory on UserMailbox.
After troubleshooting the issue, I found that the users existing on premise attributes relating to on old/existing mailbox settings was causing a conflict.
To remove the conflicting attributes, I opened up ADSI edit (Warning: Be careful with ADSI edit!), expanded Default Naming Content > DC=ABCCOMPANY,DC=COM,DC=AU, then located the user account in question – email@example.com, right-clicked the user and chose Properties.
Then, from within the properties dialog box, find any entry beginning with msExh, and clear the currently entered value by clicking the Clear button.
You’ll need to perform a DIRSYNC up to Office 365 to sync up the changes. Once done, re-run Enable-RemoteMailbox.