Managing external identities to enable secure access for partners, customers, and other non-employees
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^
Recommended handling
- Treat the first generic server error as indeterminate.
The directory Write might have committed even though the journey did not complete successfully. - When the next Write returns
ClaimsPrincipalAlreadyExists, stop issuing create Writes.
Do not interpret the subsequent read failure as proof that creation did not occur. - 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. - 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. - 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:
-
RaiseErrorIfClaimsPrincipalDoesNotExistraises an error when a Read cannot locate the object. -
RaiseErrorIfClaimsPrincipalAlreadyExistsapplies 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:
- Record the policy name, UTC timestamp, and correlation ID for the initial Write, repeated Write, and password-reset Read.
- Locate each correlation ID in the Application Insights traces.
- Compare the technical profiles executed, input claim values, claims transformations, and exceptions.
- 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