A security engineer at a company using Azure OpenAI for document analysis needs to ensure that the application properly handles authentication token expiration without service disruption. The application uses a managed identity. Which Azure SDK pattern implements proper token lifecycle management?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal — b is correct because the Azure Identity SDK's DefaultAzureCredential and ManagedIdentityCredential implementations include built-in token caching and proactive renewal: they cache acquired tokens and automatically obtain new tokens before expiration (typically renewing when the token has 5 minutes remaining), eliminating service disruptions due to token expiration. A is incorrect because caching tokens at startup and restarting hourly is fragile, causes service disruptions at restart, and does not handle token expiration gracefully mid-operation.
Full explanation below image
Full Explanation
B is correct because the Azure Identity SDK's DefaultAzureCredential and ManagedIdentityCredential implementations include built-in token caching and proactive renewal: they cache acquired tokens and automatically obtain new tokens before expiration (typically renewing when the token has 5 minutes remaining), eliminating service disruptions due to token expiration. A is incorrect because caching tokens at startup and restarting hourly is fragile, causes service disruptions at restart, and does not handle token expiration gracefully mid-operation. C is incorrect because Azure OpenAI calls use short-lived OAuth 2.0 access tokens (typically 1 hour); Conditional Access token lifetime policies affect session/refresh tokens, not the access token lifetime for service-to-service calls. D is incorrect because storing tokens in Key Vault requires custom renewal logic and does not provide the seamless automatic renewal that the Azure Identity SDK provides natively.