Here’s a small Friday afternoon snippet of useful information for all you Office 365/Identity nerds out there.
If you have converted an AAD user from ‘Synced with Active Directory’ to ‘In Cloud’ and you want to sync a new user object with that user, you will need to clear the ImmutableID and then match it up with the new user object. I’m planning on creating a more extensive post on that very subject in the near future, but for now, I’ll give you this titbit of information:
Clearing the ImmutableID is done using the Powershell command:
Set-MSOLUser -UserPrincipalName emily@misstech.co.uk -ImmutableID "$null"
You might think that those quote marks are a bit pointless, but you would be wrong! If you were to run the command as shown below, without the “” marks, it wouldn’t show you an error, but it also wouldn’t actually clear the ImmutableID.
Set-MSOLUser -UserPrincipalName emily@misstech.co.uk -ImmutableID $null
As with all things PowerShell, syntax is everything!
Thanks, you saved my day! I’ve been struggling with this very issue for the past few hours.
LikeLike
I just copy Zoltans post! “Thanks, you saved my day! I’ve been struggling with this very issue for the past few hours.”
LikeLike
Hello, I need help with matching user accounts on-prem with mailboxes in the cloud. I am following these two articles
https://gallery.technet.microsoft.com/Change-ImmutableID-using-59e3e955
& http://mstechtalk.com/understand-and-modify-office365-users-immutableid/
but when i delete the on-prem ad account and run remove-msoluser -UPN, and restore it back, the status still shows Synced with AD. what am i doing wrong?
LikeLike
Not clear what you are trying to achieve. Do you try to match an on-prem account with an O365 account? If so, then you can set the ImmutableId property on the cloud account to match the on-prem account. The ImmutableId property doesn’t exit on-pre, It is derived from the on-prem user’s ObjectGUID parameter. You can use the script at https://gallery.technet.microsoft.com/office/Covert-DirSyncMS-Online-5f3563b1 to obtain the ImmutableId for a given on-prem user. Then you can set the cloud user’s ImmutableId to this value and tyou can be sure that DirSync will link the two and your cloud user will sync from on-prem.
However if you don’t want to link a cloud account with an on-prem account (you want to leave it in-cloud) then your best bet is to move the on-prem account out of the scope of DirSync. I assume you scoped DirSync (more precisely, AAD Connect these days) to a select list of OUs. If you just scoped it to the entire AD forest then you’re in for a more extensive filtering exercise. You have two options in this case:
1. Reinstall DirSync and scope it to relevant OUs.
2. Configure filtering based on object property values. For instance if CustomProperty10 has a value of O365 then it will be synched. Otherwise it will not.
The space here is not enough to give you detailed instructions, you have to google it. A good starting point is to search for articles on o365 object matching.
Again, it isn’t clear from your post whether matching objects is a good or bad thing, and what is that you actually try to achieve.
LikeLike
Thanks for the post. Set-MSOLUser -UserPrincipalName dd@doubledit.co.uk -ImmutableID “” does the same thing – the string is the thing 🙂
LikeLike
Great stuff. Really helped.
One thing I found. If you’re getting the error “You must provide a required property: Parameter name: FederatedUser.SourceAnchor” on O365,
then chances are you need to set your UPN to your “*.onmicrosoft.com” address, clear the ImmutableID, then change the UPN back.
Easy way to do this in powershell is to use the command:
Set-MSOLUserPrincipalName -UserPrincipalName “joe.bloggs@domain.com” -NewUserPrincipalName “joe.bloggs@acc.onmicrosoft.com”
Then follow Miss Tech’s guide. Then change the UPN back.
LikeLike
Great tip! Follow-up: If you are trying resync a previously synced tenant, you can clear the immutableID of all cloud users before configuring AzureADConnect to the new AD so it matches by email\UPN. Otherwise, you will end up with two accounts, one in cloud and one representing the AD account.
LikeLike
Thanks Fred! Great point. Also, if you want to manage Exchange attributes in the new AD you can tie them together using Enable-RemoteMailbox in onprem.
LikeLike
Here is a challenge for you: This method works excellently for Users, but can you find a way to do this for a Distribution Group…?
So far all my migration methods involve Delete – AAD Sync – Recreate as cloud only group.
LikeLike
Hello! I know this post is old, but apparently one can no longer set the ImmutableID to null value. It was a bug this whole time that’s been fixed recently:
“As per our communication we would like to inform you that the command to delete the immutable id is not in function as it is not supposed to run successful by design, however it was working before due to some issues.”
If you try to run it now, you receive this message:
“Set-MsolUser : Unable to update parameter. Parameter name: IMMUTABLEID.”
Seeing if anyone has come across this yet with alternative solutions.
LikeLike
Thanks for your post 🙂 a feature in Azure AD arrived a while back which changes the attribute used for the ImmutableID. We now use the msds-consistencyguid which helps with cross domain moves.
LikeLike
this will help with cross domain moves, but what’s the way to transfer a synced unser into a ‘cloud only’ user?
LikeLike
Remove from sync and then restore the user account is the simplest way 🙂
LikeLike
This will stop the sync process for this user but the after restoring in the Azure portal the user source is still “Windows Server AD”.
LikeLike
Looks like Microsoft agreed, that this would be a usefull feature…
(https://feedback.azure.com/forums/169401-azure-active-directory/suggestions/36479119-allow-conversion-of-ad-synced-accounts-to-in-clou)
Rob de Jong (Azure AD IAM) comment 2018/01/18
Hi folks –
I’m happy to get back to you with good news: based on customer response we decided to revert the bug fix that caused the issue you were seeing and this should now be fixed.
Our apologies for any inconveniences this may have caused and thanks for your feedback here and working with us to get this resolved.
Thanks,
Rob
LikeLike
Amazing that this isn’t noted anywhere on Microsoft’s documentation. Was struggling to understand why this wasn’t working for me. Useful article even 6 years later!
Thanks 🙂
LikeLike