This is a very obscure problem, so I’m recording this more for my own reference in future rather than expecting anyone else to have the same issue!

The issue occurs when a migration from a hybrid exchange domain to another domain which uses AD Sync has been completed in the following manner:

  1. filter/delete user in current domain
  2. AD Sync soft deletes mailbox
  3. Create user in new domain (in a filtered OU that won’t be synchronised)
  4. Obtain new account GUID and convert to immutableID string (base64)
  5. Undelete mailbox (mailbox becomes cloud mailbox)
  6. Assign ImmutableID to mailbox (from the target account)
  7. Move target account to a synchronised OU then allow AD sync to hard match the accounts
  8. For some reason, there is a need to reverse this migration.  So filter/delete user in new domain
  9. AD Sync soft deletes mailbox
  10. Re-create or unfilter user in old hybrid domain
  11. Obtain account GUID and convert to immutableID string (base64)
  12. Undelete mailbox (mailbox becomes cloud mailbox)
  13. Assign ImmutableID to mailbox (from the original account) using the command

At this point the following error is received:

The fix is to run…

Find the user with the ImmutableID matching the one you are trying to assign

Then you should be able to run

…if you still have a problem, find the user’s objectID with

And run…