You are developing an ASP.NET Core Web API that runs in an autoscaling Azure App Service plan. The Web API authenticates users using the Microsoft Identity Platform. It must make downstream calls to Microsoft Graph on behalf of the signed-in user by using the OAuth 2.0 On-Behalf-Of (OBO) flow.
During load testing, you observe that downstream calls experience intermittent latency and fail with HTTP 429 (Too Many Requests) errors from Microsoft Entra ID. You determine that because the App Service scales out to multiple instances, each instance maintains a separate in-memory token cache, resulting in frequent, redundant token exchange requests to Microsoft Entra ID.
You need to resolve the performance issue and prevent rate-limiting while maintaining the signed-in user's context for Microsoft Graph calls.
Which of the following configuration changes should you implement?
- AEnable a system-assigned managed identity on the Azure App Service host to bypass user-delegated token acquisition for Microsoft Graph.
- BGenerate a Shared Access Signature (SAS) token with appropriate delegated permissions and pass it in the authorization header of downstream requests.
- Configure a distributed cache (such as Azure Cache for Redis) and register it in the application startup using the AddDistributedTokenCaches method.Answer
- DWrite custom middleware to extract, encrypt, and store the user's delegated access tokens inside Azure Key Vault Secrets.