An Azure service that provides hosted, universal storage for Azure app configurations.
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
Yes, APIM imposes a ~2 KB query-string limit which is being exceeded. The fix is to use Azure AD’s supported form_post response mode so the code is sent in the body, not the URL. No APIM/AppGW setting can increase the URL length limit – the solution is to change the OAuth flow accordingly.
Reference for limits:
Recommended Solution: Use response_mode=form_post
The most robust and secure way to fix this is to change the way Entra ID sends the authorization code back to your application. Instead of using the default query mode (which puts the code in the URL), you should use form_post.
- How it works: When you initiate the login request to Entra ID, add the parameter
response_mode=form_post. - Benefits: * Bypasses URL Limits: The authorization code is sent in the HTTP POST body, which has a much higher limit (up to 2MB or more on WAF) than the URL query string.
- Security: Tokens and codes are not stored in browser history or server access logs because they are not part of the URL.
- Requirement: Your backend (Azure Container App) must be configured to accept a
POSTrequest on your callback/redirect URI (e.g.,/callBack). - Reference: Microsoft Identity Platform Response Modes