Colin Wade Thank you for the detailed clarification. That helps narrow this down significantly.
Even though OpenID Connect is not something you configure directly, ASP.NET Core Identity uses OIDC internally when Challenge() is invoked with the Microsoft provider. The /signin-microsoft endpoint you’re seeing is the internal callback endpoint registered by the authentication middleware, and its responsibility is to process the authorization response (code, state, session_state), establish the authentication session, and then issue a 302 redirect to your configured ExternalLoginCallback.
Given that:
The request reaches /signin-microsoft
The response is a default IIS 404
Application Insights does not log the request
The failure occurs before your callback controller is reached
The only observable difference is larger code and state values in failing cases
This strongly indicates that the request is being rejected at the IIS or infrastructure layer before the ASP.NET Core middleware pipeline executes, rather than failing inside Identity or your application logic.
A common cause of this behavior is IIS request filtering limits, particularly:
Maximum query string length
Maximum URL length
When these limits are exceeded, IIS returns a 404 immediately and does not forward the request to the application, which matches the behavior you’re observing exactly. This also explains why:
The issue affects only certain external tenants
It began recently
Successful and failing requests differ only in parameter size
Some tenants (for example, those with Conditional Access, MFA, or additional claims) can generate larger authorization payloads, increasing the size of the code and state parameters.
Recommended next steps
Review IIS logs for the failing requests to confirm rejection at the web server level.
Verify or temporarily increase request limits in IIS, for example:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxUrl="8192" maxQueryString="8192" />
</requestFiltering>
</security>
</system.webServer>
- If applicable, also check any reverse proxy, WAF, or load balancer in front of IIS for similar request size limits.
under the answer to close this question.