Forum Discussion
Using Cloud sync to sync AD to existing Entra Accounts
I want to sync in premise AD accounts with existing Entra accounts. The email on both accounts is the same, and I added the Entra/o365 suffix to the domain and set the UPN to that suffix, making both UPN(s) the same. It did not sync. It created a NEW Entra account. I thought I covered all my bases.
How can I get on premise AD and existing Entra accounts to sync?
thank you
Hi, matching only by email address can unfortunately be unreliable.
Before bringing the users into the Cloud Sync scope, I would compare the on-premises UPN, primary SMTP address, proxy addresses and existing Entra account. Also confirm that the cloud account is not already controlled by another synchronization engine.
For a controlled migration, use the source anchor or onPremisesImmutableId to hard-match the existing Entra account instead of relying only on soft matching.
I would start with two or three test users in a separate OU. If a duplicate account has already been created, pause synchronization for that user before deleting or changing anything, especially when a mailbox and licences are attached.
5 Replies
- ali_zCopper Contributor
You're close. When a hard match SHOULD work but the object still won't link, it's almost always one of four things. Work it diagnostic-first:
1) Pull the actual error. Run Provision on demand against the one test user and read what it says:
- Entra admin center > Entra ID > Entra Connect > Cloud sync
- Under Configuration, select your config > left menu > Provision on demand
- Paste the user's Distinguished Name > Provision
Success shows four green checks; a failure shows the step and error on the left. You're looking for InvalidSoftMatch vs InvalidHardMatch they point to opposite fixes. (Note: Cloud Sync has no manual delta sync, the scheduled cycle is only every 10–20 min, so this is the only way to test on the spot.)
2) ImmutableID must be Base64 of the anchor, not the raw GUID. This trips up almost everyone. Compare:
[System.Convert]::ToBase64String((Get-ADUser <sam>).ObjectGUID.ToByteArray()) Get-MgUser -UserId <upn> -Property OnPremisesImmutableId | Select OnPremisesImmutableId
Byte-for-byte or it won't hard match. Cloud Sync default anchor is ms-DS-ConsistencyGUID, but on a new forest it sometimes uses objectGUID if ConsistencyGUID is empty, base it on objectGUID.3) Confirm the old duplicate is HARD-deleted, not soft-deleted. It sits in the recycle bin for 30 days still owning the UPN/proxyAddresses/anchor, which silently blocks the match:
Get-MgDirectoryDeletedItemAsUser | ? { $_.UserPrincipalName -like "*<name>*" } Remove-MgDirectoryDeletedItem -DirectoryObjectId <id>
4) The July 1, 2026 hard-match hardening could be the most likely issue in your case since Entra now auto-blocks a hard match when the target has onPremisesObjectIdentifier set or BlockCloudObjectTakeoverThroughHardMatchEnabled is on. Microsoft's documented trigger, object restored from the recycle bin, then re-added to scope trying to take over an object with the same sourceAnchor which matches your situation almost exactly. That shows as InvalidHardMatch; fix is to review the takeover-protection setting, not re-edit attributes.Given you've cleared the roles, aligned the ID, and removed the duplicate, it's #3 or #4. Run Provision on demand and post the error code.
- tjcooper2Copper Contributor
Well, it was a disaster. I setup up a filter and the sync process was creating a new account (due to roles). I then changed the filter and it deleted everything. I removed the configuration and restored the accounts.
I then removed the roles on my test account (mine), then setup the configuration again with the filter pointing a test OU again, and now it won't sync as it recognizes there is an existing Entra account with conflicting attributes.
UPN, SMTP are the same in Entra and in AD.
Hi, matching only by email address can unfortunately be unreliable.
Before bringing the users into the Cloud Sync scope, I would compare the on-premises UPN, primary SMTP address, proxy addresses and existing Entra account. Also confirm that the cloud account is not already controlled by another synchronization engine.
For a controlled migration, use the source anchor or onPremisesImmutableId to hard-match the existing Entra account instead of relying only on soft matching.
I would start with two or three test users in a separate OU. If a duplicate account has already been created, pause synchronization for that user before deleting or changing anything, especially when a mailbox and licences are attached.
- tjcooper2Copper Contributor
It was the syncd account that was in the deleted users that was causing a conflict. I deleted that and I was able to copy the onPremisesImmutableId to the Azure/Entra account.
the OnPremisesImmutableId on premise and in Azure match. Its still not syncing.- tjcooper2Copper Contributor
The best solution to ensure accounts sync.
Create Sync OU
Clear existing roles on account in Entra
Set On premise onPremisesImmutableId on Entra Account
Move account into Sync OU
Once Sync'd add roles to account