- A
Microsoft Authentication Library (MSAL)
Why wrong: MSAL is used by client applications to acquire tokens, not by APIs to validate tokens.
- B
Microsoft.Identity.Web
Microsoft.Identity.Web provides middleware and helper classes to validate Microsoft Entra ID tokens in ASP.NET Core APIs.
- C
ADAL.NET
Why wrong: ADAL is deprecated and should not be used for new development; it does not provide the latest token validation standards.
- D
Azure.Identity
Why wrong: Azure.Identity is for authenticating to Azure services using credentials, not for validating bearer tokens in an API.
Quick Answer
The answer is Microsoft.Identity.Web, the recommended library for validating Entra ID tokens in ASP.NET Core APIs. This library simplifies authentication by automatically handling OAuth 2.0 bearer token validation, including JWT signature verification, issuer signing key retrieval, and audience checks, so you don’t need to manually configure middleware or parse tokens. On the AZ-204 exam, this tests your understanding of integrating Microsoft Entra ID with modern ASP.NET Core applications—a common scenario where candidates might mistakenly choose older libraries like MSAL.NET or JwtSecurityTokenHandler. The trap is that MSAL.NET is for acquiring tokens, not validating them in APIs, while Microsoft.Identity.Web wraps the necessary middleware (AddMicrosoftIdentityWebApi) and policy enforcement in one package. For a quick memory tip: think “Web for Web API”—Microsoft.Identity.**Web** is your go-to when building a **web** API that must validate tokens from Entra ID.
AZ-204 Implement Azure security Practice Question
This AZ-204 practice question tests your understanding of implement azure security. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
You are developing a web API that must authenticate requests using Microsoft Entra ID (Microsoft Entra ID) and OAuth 2.0 bearer tokens. You want to validate the token in your API code. Which library should you use?
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
Microsoft.Identity.Web
Microsoft.Identity.Web is the recommended library for integrating ASP.NET Core web APIs with Microsoft Entra ID. It provides built-in token validation, policy enforcement, and handles the OAuth 2.0 bearer token flow, including JWT validation, issuer signing keys, and audience checks, without requiring manual configuration of middleware.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Microsoft Authentication Library (MSAL)
Why it's wrong here
MSAL is used by client applications to acquire tokens, not by APIs to validate tokens.
- ✓
Microsoft.Identity.Web
Why this is correct
Microsoft.Identity.Web provides middleware and helper classes to validate Microsoft Entra ID tokens in ASP.NET Core APIs.
Related concept
Read the scenario before looking for a memorised answer.
- ✗
ADAL.NET
Why it's wrong here
ADAL is deprecated and should not be used for new development; it does not provide the latest token validation standards.
- ✗
Azure.Identity
Why it's wrong here
Azure.Identity is for authenticating to Azure services using credentials, not for validating bearer tokens in an API.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates confuse token acquisition libraries (MSAL, Azure.Identity) with token validation libraries, leading them to pick MSAL because it is commonly associated with Entra ID authentication, even though it does not validate bearer tokens in an API.
Detailed technical explanation
How to think about this question
Under the hood, Microsoft.Identity.Web configures the ASP.NET Core JWT Bearer middleware to validate tokens against the Microsoft Entra ID tenant's OpenID Connect discovery document. It automatically handles token lifetime, issuer, audience, and signing key rotation, and supports scopes and app roles via the [Authorize] attribute. In a real-world scenario, using Microsoft.Identity.Web simplifies multi-tenant API development by abstracting tenant-specific metadata endpoints.
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.
TExam Day Tips
- 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.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A company's IT admin needs to give a contractor read-only access to production logs without sharing account credentials. Using role-based access control (RBAC) and temporary scoped permissions — not a permanent shared password — is the correct pattern. Questions like this test whether you can apply least-privilege access across cloud identity services.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Implement Azure security — study guide chapter
Learn the concepts, then practise the questions
- →
Implement Azure security practice questions
Targeted practice on this topic area only
- →
All AZ-204 questions
997 questions across all exam domains
- →
Microsoft Azure Developer Associate AZ-204 study guide
Full concept coverage aligned to exam objectives
- →
AZ-204 practice test guide
How to use practice tests most effectively before exam day
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.
Develop Azure compute solutions practice questions
Practise AZ-204 questions linked to Develop Azure compute solutions.
Develop for Azure storage practice questions
Practise AZ-204 questions linked to Develop for Azure storage.
Implement Azure security practice questions
Practise AZ-204 questions linked to Implement Azure security.
Connect to and consume Azure services and third-party services practice questions
Practise AZ-204 questions linked to Connect to and consume Azure services and third-party services.
Monitor, troubleshoot, and optimize Azure solutions practice questions
Practise AZ-204 questions linked to Monitor, troubleshoot, and optimize Azure solutions.
AZ-204 fundamentals practice questions
Practise AZ-204 questions linked to AZ-204 fundamentals.
AZ-204 scenario practice questions
Practise AZ-204 questions linked to AZ-204 scenario.
AZ-204 troubleshooting practice questions
Practise AZ-204 questions linked to AZ-204 troubleshooting.
Practice this exam
Start a free AZ-204 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this AZ-204 question test?
Implement Azure security — This question tests Implement Azure security — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Microsoft.Identity.Web — Microsoft.Identity.Web is the recommended library for integrating ASP.NET Core web APIs with Microsoft Entra ID. It provides built-in token validation, policy enforcement, and handles the OAuth 2.0 bearer token flow, including JWT validation, issuer signing keys, and audience checks, without requiring manual configuration of middleware.
What should I do if I get this AZ-204 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more ways this is tested on AZ-204
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. You are developing a web API hosted on Azure App Service. The API must authenticate requests using Microsoft Entra ID OAuth 2.0 bearer tokens. You want to validate the token in your ASP.NET Core API code with minimal custom validation logic. Which library should you use?
hard- A.Microsoft Authentication Library (MSAL)
- B.Azure Identity client library
- ✓ C.Microsoft.Identity.Web
- D.Azure Management Libraries for .NET
Why C: Microsoft.Identity.Web is the correct choice because it provides a high-level, opinionated library that integrates directly with ASP.NET Core's authentication pipeline, handling token validation, scopes, and app roles with minimal custom code. It abstracts away the complexity of JWT bearer token validation against Microsoft Entra ID, including automatic OpenID Connect discovery and token signature verification.
Last reviewed: Jun 11, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.