hardmultiple choiceObjective-mapped

You are developing an ASP.NET Core web API that authenticates users via Microsoft Entra ID. The API needs to call a downstream API (also secured by Microsoft Entra ID) on behalf of the signed-in user (On-Behalf-Of flow). You have already configured the web API to authenticate users with Microsoft.Identity.Web. How should you implement the token acquisition for the downstream API?

Question 1hardmultiple choice
Full question →

You are developing an ASP.NET Core web API that authenticates users via Microsoft Entra ID. The API needs to call a downstream API (also secured by Microsoft Entra ID) on behalf of the signed-in user (On-Behalf-Of flow). You have already configured the web API to authenticate users with Microsoft.Identity.Web. How should you implement the token acquisition for the downstream API?

Answer choices

Why each option matters

Good practice is not just finding the correct option. The wrong answers often show the exact trap the exam wants you to fall into.

A

Distractor review

Use ADAL.NET's `AcquireTokenOnBehalfOf` method

ADAL.NET is deprecated in favor of MSAL.NET and Microsoft.Identity.Web. While it can technically work, the modern and recommended approach is to use Microsoft.Identity.Web.

B

Best answer

Inject `ITokenAcquisition` and call `GetAccessTokenForUserAsync` with the scopes for the downstream API

`ITokenAcquisition` from Microsoft.Identity.Web wraps MSAL.NET. `GetAccessTokenForUserAsync` performs the On-Behalf-Of flow, exchanging the user's token for a token to call the downstream API.

C

Distractor review

Use the `Azure.Identity` library with `DefaultAzureCredential` to acquire a token

`DefaultAzureCredential` supports managed identity, Azure CLI, etc., but does not support the On-Behalf-Of flow to act on behalf of a user. It is used for service principal authentication.

D

Distractor review

Manually construct an HTTP POST to the Microsoft Entra ID token endpoint with the user access token and client credentials

While possible, this approach requires handling token caching, errors, and validation manually. Microsoft.Identity.Web abstracts all this complexity and is the recommended method.

Common exam trap

Common exam trap: answer the scenario, not the keyword

Many certification questions include familiar terms but test a specific constraint. Read the exact wording before choosing an answer that is generally true but wrong for this case.

Technical deep dive

How to think about this question

This question should be treated as a scenario, not a definition check. Identify the problem, the constraint and the best action. Then compare each option against those facts.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.
  • Use explanations to understand the rule behind the answer.

TExam Day Tips

  • Underline the problem statement mentally.
  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Related practice questions

Related AZ-204 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

More questions from this exam

Keep practising from the same exam bank, or move into a focused topic page if this question exposed a weak area.

Question 1

An application stores customer invoices in Azure Blob Storage. Deleted blobs must be recoverable for 14 days. What should be enabled?

Question 2

You are deploying a containerized application to Azure Container Instances. The application requires a custom domain name and SSL/TLS termination. You need to configure these features. Which resource should you create alongside the container group?

Question 3

A developer needs to run a Kusto query against application request data to identify 95th percentile latency by operation. Where should the query be run? The architecture review board prefers a managed AWS-native control.

Question 4

You are developing a web app that authenticates users via Microsoft Entra ID. The app needs to read the user's profile and send emails on their behalf. You want to minimize user consent prompts. Which OAuth 2.0 grant type should you use?

Question 5

You are developing an Azure Function that processes messages from an Azure Service Bus queue. The function uses a Service Bus queue trigger and runs on a Consumption Plan. The queue receives a high volume of messages in bursts. You need to ensure that the function scales out to handle the load but does not exceed 10 concurrent instances. Which configuration should you apply?

Question 6

You are monitoring an Azure App Service using Application Insights. You notice that the server response time is high for certain requests. You need to drill down to see which external dependencies (like databases or APIs) are causing the delay. Which Application Insights feature should you use?

FAQ

Questions learners often ask

What does this AZ-204 question test?

Read the scenario before looking for a memorised answer.

What is the correct answer to this question?

The correct answer is: Inject `ITokenAcquisition` and call `GetAccessTokenForUserAsync` with the scopes for the downstream API — Microsoft.Identity.Web provides the `ITokenAcquisition` interface that simplifies token acquisition. The `GetAccessTokenForUserAsync` method implements the OAuth 2.0 On-Behalf-Of flow, using the user's original token to request a token for the downstream API. ADAL.NET is deprecated, and manually constructing HTTP requests is error-prone. Managed Identity is for service-to-service without user context.

What should I do if I get this AZ-204 question wrong?

Then try more questions from the same exam bank and focus on understanding why the wrong options are tempting.

Discussion

Loading comments…

Sign in to join the discussion.