Question Regarding Entra SCIM Provisioning Exporting Old userName Value

Shree Varshan G 40 Reputation points
2026-05-22T06:06:32.2966667+00:00

Hi Microsoft Team,

We are observing an issue with SCIM provisioning from to our application where the exported userName value during provisioning does not match the current User Principal Name (UPN) shown in Entra ID for a specific user.

Current observation:

  • Current UPN in Entra ID: <pii removed>@gmail.com

Exported userName in Provisioning Logs: <pii removed>@gmail.com

The <pii removed>@gmail.com value is an older/incorrect email and is no longer visible in the user's current Entra profile attributes.

Additional details:

The SCIM mapping is configured as: userPrincipalName -> userName

We tested multiple reprovisioning scenarios in another tenant and could not reproduce the behavior.

On-Demand Provisioning was executed for the affected user, but Entra provisioning still exported the old userName value.

  • Newly created and reprovisioned users export the correct/latest UPN as expected.
  • I tested manually changed the upn and done an on demand provisioning it works by sending the latest upn

Could you help clarify:

  1. Under what conditions can Entra provisioning continue exporting an older userName value even after the UPN has changed?
  2. Why provision on demand sending the some email address that is not a upn

Regards,

Shree

Microsoft Security | Microsoft Entra | Microsoft Entra ID

Answer accepted by question author
Sina Salam 31,376 Reputation points Volunteer Moderator
2026-05-22T12:02:19.6033333+00:00

Hello Shree Varshan G,

Welcome to the Microsoft Q&A and thank you for posting your questions here.

I understand that you have Question Regarding Entra SCIM Provisioning Exporting Old userName Value.

Most of all, regarding your questions:

Under what conditions can Entra provisioning continue exporting an older userName value even after the UPN has changed?

When:

  • User already matched using old value
  • Matching attribute still resolves to that identity
  • Target object holds legacy identifier

Why provision on demand sending the some email address that is not a upn

Because:

The cause is not simply the userPrincipalName → userName mapping. The issue is caused by the existing provisioning matching/correlation state between Microsoft Entra ID and the target SCIM application. - https://learn.microsoft.com/en-us/entra/identity/app-provisioning/how-provisioning-works, https://learn.microsoft.com/en-us/entra/identity/app-provisioning/customize-application-attributes

The best practice advice to you is to:

After the matching rule is changed to an immutable identifier and the stale target correlation is removed, Microsoft Entra will correctly identify the target account by externalId and export the current UPN into userName as expected.

Use the below official Microsoft resources for more reading and steps:

I hope this is helpful! Do not hesitate to let me know if you have any other questions, steps or clarifications.


Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Shubham Sharma 17,925 Reputation points Microsoft External Staff Moderator
    2026-05-25T05:48:10.28+00:00

    Shree Varshan G

    Thank you for your reply.

    Why you are seeing alias (******@gmail.com) as userName

    This behavior is not random — it occurs due to a combination of SCIM identity anchoring, matching logic, and source attribute resolution differences (Exchange vs Entra).

    1. userName acts as the persistent identifier (anchor)

    In SCIM, userName is commonly treated as a unique identifier/login ID.

    https://community.rsa.com/s/article/User-Provisioning-Using-SCIM-API-1e4ce6aa

    Once a user is created in the target system, Entra provisioning correlates future updates using the previously sent identifier.

    Even if the Entra attribute (UPN) changes, the provisioning service may continue to:

    reuse the original value (cached / matched value)

    or use a value returned by the target during matching

    This explains why an old alias or previously used email can continue appearing as userName.

    2. Matching / correlation can override mapping behavior

    In provisioning:

    Entra does not blindly push mappings every time

    Instead, it:

    Finds the existing user in the target

    Matches based on identifiers (userName, emails, externalId, etc.)

    Uses that identity for updates

    If your target system:

    treats emails[type eq "work"].value as unique identifier

    OR returns alias (******@gmail.com) as primary

    Entra may reuse that value for userName during updates, even though mapping says UPN.

    3. Exchange / proxyAddresses influence

    Your scenario strongly indicates Exchange-backed attributes:

    Users have:

    UPN = ******@gmail.com

    Primary mail = ******@gmail.com

    Alias = ******@gmail.com

    In Microsoft Entra:

    Email-related attributes come from Exchange attributes like proxyAddresses and mailNickname

    https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/plan-connect-userprincipalname

    Different services may resolve:

    Primary SMTP

    Alias

    mail attribute

    Depending on synchronization timing and attribute source:

    Alias (******@gmail.com) can still be considered authoritative in some flows

    4. Attribute mapping is NOT strictly authoritative on updates

    Even with correct mapping:

    userPrincipalName -> userName

    mail -> emails[type eq "work"].value

    Entra provisioning engine:

    uses delta sync logic

    only updates attributes when change is detected AND allowed in flow settings

    Matching + cached state can still override mapping

    Microsoft explicitly states mappings must be carefully aligned, otherwise:

    incorrect or unintended values can be provisioned if mappings don’t align with application schema and identity logic

    https://microsoft.github.io/zerotrustassessment/docs/workshop-guidance/identity/RMI_120

    5. Why values look “interchanged”

    Observed:

    userName = alias (abc)

    emails = primary (def)

    This typically happens when:

    Target system:

    promotes alias as login/identifier

    Entra:

    still sends mail correctly

    But correlation phase influences userName selection

    So, it is not true swapping — it is:

    Different attributes being sourced from different identity anchors

    Below is the recommended resolution: -

    Option 1 — Force deterministic mapping

    Update mappings:

    Set userName mapping to:

    FlowType = Always (Create + Update)

    This ensures UPN is always re-sent (not just on create)

    Doc: https://learn.microsoft.com/en-us/entra/identity/app-provisioning/customize-application-attributes

    Option 2 — Change correlation strategy

    Update Matching precedence:

    Prefer:

    externalId (objectId) (already correct in your screenshot)

    Avoid:

    matching based on emails or userName if target behaves differently

    This prevents alias-based re-correlation

    Option 3 — Reset target identity

    Because SCIM is stateful:

    Delete user from target system

    OR

    Use:

    “Restart provisioning with clear state”

    Forces:

    fresh Create call

    correct userName = UPN

    Option 4 — Align email mapping source

    Instead of:

    mail → emails[type eq "work"].value

    Use (recommended in many integrations):

    userPrincipalName → emails[type eq "work"].value

    Ensures:

    both userName and emails come from same source

    avoids alias confusion

    https://facilio.com/help/docs/admin-guide/users-and-control/user-management/scim-provisioning/scim-azure-ad/

    Option 5 — Validate Exchange attributes

    Check in user object:

    proxyAddresses

    Primary SMTP (uppercase SMTP:)

    Aliases (smtp:)

    Ensure:

    correct primary email is set

    no stale alias marked incorrectly

    Was this answer helpful?

    4 people found this answer helpful.

Your answer

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