User principal name change in AD not syncing to Microsoft

Sheila 5 Reputation points
2025-01-06T03:21:41.3833333+00:00

We having users changing their last names but experiencing issues with sync from on-premise AD to microsoft.

This post Why does the userPrincipalName not sync from AD to Azure AD like - Microsoft Community is basically what we are experiencing but wondering why and what command exactly to use?

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,821 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,993 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Harpreet Singh Matharoo 8,311 Reputation points Microsoft Employee
    2025-01-06T04:19:37.9433333+00:00

    Hello @Sheila ,

    Thank you for reaching out to Microsoft QnA forum. Historically, updates to the UserPrincipalName attribute using the sync service from on-premises was blocked, From March 2019, synchronizing UPN changes for federated user accounts is allowed. If your AD Connect setup was performed before 2019 there are high chances that Directory Sync Service feature "SynchronizeUpnForManagedUsersEnabled" is set to False. This results in not sync UPN changes from AD to AAD/Entra ID.

    For all new deployments, this feature is on by default for newly created Microsoft Entra directories. You can see if this feature is enabled for you by running:

    Connect-MgGraph -Scopes "OnPremDirectorySynchronization.Read.All"
    $DirectorySync = Get-MgDirectoryOnPremiseSynchronization
    $DirectorySync.Features.SynchronizeUpnForManagedUsersEnabled
    

    If this feature isn't enabled for your Microsoft Entra directory, then you can enable it by running:

    Connect-MgGraph -Scopes "OnPremDirectorySynchronization.ReadWrite.All"
    $SyncUpnManagedUsers = @{ SynchronizeUpnForManagedUsersEnabled = "true" }
    Update-MgDirectoryOnPremiseSynchronization -Features $SyncUpnManagedUsers -OnPremisesDirectorySynchronizationId $DirectorySync.Id
    

    After enabling this feature, existing userPrincipalName values remain as-is. On next change of the userPrincipalName attribute on-premises, the normal delta sync on users updates the UPN. Once this feature is enabled, it's not possible to disable it.

    For more information on UPN updates please refer following article: https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-syncservice-features#synchronize-userprincipalname-updates

    Hope this will help. Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.