Question

Difficulty: EasyMicrosoft Identity Platform Authentication

You are developing a C# desktop application that needs to authenticate users against Microsoft Entra ID using the Microsoft Identity Platform.

Which two components from the Microsoft.Identity.Client namespace must you use to configure and represent the client application?

Select two.

  1. PublicClientApplicationBuilderAnswer
  2. B
    ConfidentialClientApplicationBuilder
  3. IPublicClientApplicationAnswer
  4. D
    IConfidentialClientApplication

Answer

The application must use PublicClientApplicationBuilder to configure the application and IPublicClientApplication to represent the instantiated client application.
For a desktop application, which cannot securely store client secrets, you must use a public client flow. In MSAL.NET, public client applications are configured using the PublicClientApplicationBuilder and represented by the IPublicClientApplication interface.

Step-by-Step Solution

1
Determine the application type based on the deployment scenario.
Since a desktop application runs on a user's device and cannot keep client secrets secure, it is classified as a public client application.
Microsoft Identity Platform distinguishes between public clients (desktop/mobile) and confidential clients (web apps/daemons).
2
Select the correct builder class to instantiate the application.
Use the PublicClientApplicationBuilder class from the Microsoft.Identity.Client namespace to build the application configuration.
The builder pattern is used in MSAL.NET to construct the client application instance with required settings like Client ID and Tenant ID.
3
Identify the correct interface type representing the instantiated client.
The builder's Build() method returns an object implementing the IPublicClientApplication interface.
IPublicClientApplication provides the methods needed to acquire tokens for public clients, such as AcquireTokenInteractive.

Key Concept

Identifying MSAL client types and initializing MSAL.NET public client applications.
Rate this question