As simple as it sounds, there are many pitfalls when it comes to integrating your directory with Office 365. The bulk of these issues stem from the provisioning side of the integration by not matching up the correct unique identifiers in both of the user accounts. In some cases, Office 365 is not listing an Immutable ID for an end user or Office 365 is not recognizing a certain account from your cloud-based directory.
While this solution will only work for certain use cases, like the ones I mentioned above, this error is a common problem that you’ll run into if you’re finding provisioning issues to Office 365. I’ll walk you through the process of manually setting an Immutable ID in Powershell and your source directory so that the two accounts can correctly match up.
By manually setting an Immutable ID for certain end users, your source directory and Office 365 will be able to successfully recognize the user and provision him or her directly to Office 365.
1: Open Powershell and run it as an administrator
2: If you haven’t already, you’ll need to install the Office 365 powershell cmdlet. You can do that by running the following command: “Install-Module MSOnline”. If prompted, type “Y” to finish the installation.
3: Run “Connect-MsolService” to connect Powershell to your Office 365 tenant. You’ll then see a screen asking you to sign into your Office 365 Tenant. If your domain is already in a federated state, I highly recommend logging in with a .onmicrosoft.com domain global administrator account.
4: After that, have a list ready of your problematic users that aren’t syncing correctly with Office 365. For these users, you’ll first need to change the User Principal name before you change the Immutable ID. The reasoning for this step is because you cannot alter an immutable ID for a user that’s a part of a federated domain. Run the following command to change the UPN from @domain.com to @tenantname.onmicrosoft.com:
5: Once the user’s UPN is changed to a .onmicrosoft domain, you’ll now be able to alter or create an immutable ID manually. To accomplish this, I recommend visiting https://www.guidgenerator.com/ to generate your unique Immutable ID value. This is similar to what a Source directory would do to map the Immutable ID attribute.
Note: Make sure Base 64 encoding is checked before you generate your GUID
6: Now that you have your randomly generated GUID value, you can change the Immutable ID. Go ahead and run this script:
7: Since you’ve successfully changed the user’s Immutable ID, you’ll now need to change the user’s UPN back to its original state. Modify the command from step four to make it so you’re changing the UPN from the .onmicrosoft domain to the federated domain.
While we completed the Office 365 portion of this configuration, we’ll still need to make the necessary changes in the cloud directory (I’ll be using Okta as my cloud directory example).
9: In Okta, you’ll need to make sure that the provisioning Options (Create, Update, Deactivate, Sync Password) are all disabled. If the user is assigned to Office 365 currently, go ahead and unassign the user from Office 365.
10: Next, Reassign the user to Office 365. After you click assign, you’ll be prompted for a space to manually input the newly created Immutable ID. Feel free to copy/paste the value into the Immutable ID textbox.
All that’s left to do now is to assign the correct licenses and roles to the end user inside Okta and you should be all set. You’re now able to turn back on the provisioning features inside Okta to master all of your O365 users in one central location. Test authentication with the problematic user and verify that the authentication flow is successful.
Although manually setting/resetting a problematic user’s Immutable ID is not always the fix to a provisioning solution, it’s a good place to start when it comes to diagnosing certain provisioning problems. These steps offer a great way to rule out any chance that your error is stemming from a unique ID issue. If the Immutable ID fix did not correct the user synchronization, there is likely something else deeper at play. Look for other attributes that could be causing the Sync to fail, and then resync the values between Office 365 and Okta.