Some Writes returning "User Already Exists" error despite user's not being found in tenant.

Tennyson, Trevor 0 Reputation points
2026-11-23T19:03:36.8466667+00:00

We are experiencing an intermittent issue effecting 1-3% of users. A users after verifying their email address sometimes receive a generic server side error on the first submit. If they try to submit again, or reverify their email and attempt to signup again, the get a "Claims Principal Already Exists Error"

When they attempt to reset the password for the email via our forgot password User Journey the user receives a "A Claims Principal does not Exist."

This state is abandoned if the user tries to create an account again a few hours later.

Within the AAD B2C provider itself, an email-address-targeted Write configured with RaiseErrorIfClaimsPrincipalDoesNotExist=true reports that no principal exists, while an account-creation Write targeting the identical signInNames.emailAddress reports ClaimsPrincipalAlreadyExists. The state is reproducible across independent sessions/devices and clears without modification after a period of time even for the same email address.

Trying to figure out what could cause this discrepancy.

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-11-23T19:05:38.5933333+00:00

    Implement a bounded delay and then start a new B2C authorization journey instead of repeating the account-creation Write, because the contradictory results most closely match directory replication delay between the Write and Read paths.

    Microsoft Entra uses geographically distributed replicas and an eventual-consistency model; a read handled by a different replica can temporarily return stale data. Session consistency also is not guaranteed for application-only requests.^1^ A closely matching B2C case—Graph updated an email identity, but the custom-policy read could not see it until later—was attributed to propagation delay, with an initial wait and backoff recommended.^2^

    1. Treat the first generic server error as indeterminate.
      The directory Write might have committed even though the journey did not complete successfully.
    2. When the next Write returns ClaimsPrincipalAlreadyExists, stop issuing create Writes.
      Do not interpret the subsequent read failure as proof that creation did not occur.
    3. Wait briefly, then initiate a completely new sign-in/read policy request.
      Implement this outside the custom policy—for example, on an application-hosted “Finishing account setup” page. Do not attempt to resume the failed orchestration step.
    4. Retry the entire authorization journey with capped backoff.
      For example, delays of 2, 5, 10, and 20 seconds are illustrative rather than Microsoft-prescribed. Tune the delay and retry cap to the application’s latency requirements.
    5. After the cap, show “Account setup is still processing; try again later.”
      Preserve the correlation IDs and timestamps for investigation rather than attempting another account creation.

    An ASP.NET Core endpoint can start each attempt as a fresh policy authorization request:

    [HttpGet("/account/retry")]
    public async Task<IActionResult> Retry(int attempt = 0)
    {
        int[] delays = { 2, 5, 10, 20 }; // Illustrative values
        if (attempt >= delays.Length)
            return View("AccountSetupPending");
    
        await Task.Delay(TimeSpan.FromSeconds(delays[attempt]));
    
        return Challenge(
            new AuthenticationProperties {
                RedirectUri = $"/account/verify?attempt={attempt + 1}"
            },
            OpenIdConnectDefaults.AuthenticationScheme);
    }
    

    The new challenge must target the appropriate sign-in/read journey, not the sign-up journey that performs the create Write. A successful Microsoft Graph read during this interval does not prove that the custom-policy directory read can already see the object: Graph and the B2C policy can use different logical sessions or replicas.^1^

    Validate the policy inputs

    The flags are operating as documented:

    • RaiseErrorIfClaimsPrincipalDoesNotExist raises an error when a Read cannot locate the object.
    • RaiseErrorIfClaimsPrincipalAlreadyExists applies only to a Write and raises an error when that Write sees an existing object.^3^

    Consequently, the two messages can originate from separate directory operations without representing a single atomic existence check.

    Also verify from the trace—not by another browser test—that both profiles receive the exact same normalized value and mapping:

    <InputClaims>
      <InputClaim ClaimTypeReferenceId="email"
                  PartnerClaimType="signInNames.emailAddress"
                  Required="true" />
    </InputClaims>
    

    A Microsoft Entra technical profile must have exactly one input claim. For local-account creation and lookup, signInNames.emailAddress is a supported unique key.^3^ Check casing, whitespace, claim transformations, and whether an included technical profile overrides metadata or input claims.

    Capture evidence and escalate persistent cases

    Because your state can persist for hours, replication delay is the leading explanation but not a confirmed root cause. Capture each failed sequence in Application Insights:

    1. Record the policy name, UTC timestamp, and correlation ID for the initial Write, repeated Write, and password-reset Read.
    2. Locate each correlation ID in the Application Insights traces.
    3. Compare the technical profiles executed, input claim values, claims transformations, and exceptions.
    4. Record when the same email begins resolving successfully.

    Application Insights exposes the executed technical profiles, claim values, transformations, and exceptions; new traces can take up to approximately five minutes to appear.^4^

    If the mismatch regularly lasts beyond the bounded retry window, open a Microsoft support case with those correlation IDs and timestamps. That duration warrants service-side investigation after the traces confirm identical signInNames.emailAddress values and profile mappings.


    References

    1. What is the Microsoft Entra architecture?
    2. B2C custom policy retry step (for loop)? - Microsoft Q&A
    3. Define a Microsoft Entra technical profile in an Azure Active Directory B2C custom policy
    4. Troubleshoot Azure AD B2C custom policies and user flows (b2c-custom-policy)
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was 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.