Connect to and consume Azure services and third-party services →mediumMultiple ChoiceObjective-mapped
AZ-204 Practice Question: Connect to and consume Azure services and third-party services
A web app running on Azure App Service must integrate with Microsoft Graph API to read user profiles. The app is registered in Microsoft Entra ID and uses the OAuth 2.0 authorization code flow. However, after deployment, the app fails to acquire tokens. What is the most likely cause?
⚠ Common exam trap
Test-takers frequently confuse token acquisition failures with permission or secret issues, overlooking the mandatory redirect URI registration requirement for the authorization code flow.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The redirect URI is not configured in the app registration
The OAuth 2.0 authorization code flow requires a redirect URI to be registered in the app registration in Microsoft Entra ID. This URI is where the authorization server sends the authorization code after user consent. If the redirect URI is missing or mismatched, the token acquisition fails because the authorization server cannot validate the callback endpoint, causing the authentication request to be rejected.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The API permission for User.Read is not granted
Why it's wrong here
A missing API permission, such as User.Read, would typically manifest as an "Insufficient privileges" or "Access denied" (HTTP 403 Forbidden) error *after* an access token has been successfully acquired and presented to the target resource API. The problem described, however, indicates a failure in the initial token acquisition process itself, often related to the authorization request or redirect, rather than an issue with subsequent API calls using an already-obtained token.
- ✗
The app is using the client credentials flow instead of authorization code flow
Why it's wrong here
The client credentials flow is designed for server-to-server communication, where an application authenticates itself directly to Azure AD using its client ID and secret/certificate, without any user interaction or browser redirects. If the web app were incorrectly configured to use this flow, the user interaction, sign-in prompts, and redirect-related issues described in the problem statement would not occur, as the flow bypasses the user entirely.
- ✓
The redirect URI is not configured in the app registration
Why this is correct
In the OAuth 2.0 authorization code flow, Azure AD redirects the user's browser back to a pre-registered redirect URI (also known as a reply URL) on the client application, carrying the authorization code. If this URI is not configured in the Azure AD app registration, or if it does not precisely match the URI used in the authorization request, Azure AD will refuse to issue the authorization code. This critical security measure prevents code interception and is a common cause for token acquisition failures during the initial authorization phase.
- ✗
The client secret is expired
Why it's wrong here
An expired client secret would prevent the application from successfully authenticating itself to Azure AD during the token exchange phase, where the authorization code is exchanged for an access token. This specific issue would typically result in an "Invalid client secret" or "Client authentication failed" error. This error occurs later in the authorization code flow, distinct from problems related to the initial authorization request or redirect URI configuration, which manifest earlier.
Go deeper
Related to this question
About these practice questions
Courseiva writes every AZ-204 question from scratch — 881 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.