Converting DirSync User to a Cloud user in 365
I’m not sure if anyone has run into this problem before, so I figured I would share a quick fix that I found to take care of this problem. The easiest process that I have found to accomplish this without having the user be deleted each time dirsync runs is the following:
- On a domain controller in the environment, move the user out of the DirSync scope. The Domain has a Synced and UnSynced OU, moving the user to the UnSynced OU accomplishes this.
- Force replication on the DC a few times (unless there is only one DC in the environment)
- Login to Office 365 and delete the user from Office 365- this will put them in a soft-deleted state.
- From a DC in the users environment, run all of the DirSync/Azure AD Sync profiles to allow the changes to sync with 365
- From Office 365 web portal, find the users mailbox in the Deleted Users section, select the appropriate user and re-attach the mailbox. You will need to specify a new password for the user to use when accessing Office 365 since they are no longer synced with AD.
- Open up a PS-session to Office 365, Import the appropriate modules including MSOL modules
- Run the following command substituting the appropriate value. The ImmutableID is what will prevent DirSync from deleting the user’s mailbox each time it is run. ImmutableID links the 365 account to the AD account and is what DirSync looks at to bind the two accounts (generally speaking).
Set-MSOLUser -UserPrincipalName %firstname.lastname@example.org% -ImmutableID $null
- From a DC in the user’s environment, run all of the DirSync/Azure AD Sync profiles to allow the changes to sync with 365
- Validate that you can login via Office 365 with new password and that the account shows being in the cloud.