Soru

Zorluk: OrtaMicrosoft Identity Platform Authentication

You are developing a C# console application that needs to authenticate users using the Microsoft Identity Platform. The application must support signing in users from any Microsoft Entra ID tenant, but must explicitly prevent users with personal Microsoft accounts (such as Xbox, Outlook.com, or Skype accounts) from signing in.

You have the following C# code to build the public client application:

csharp
var app = PublicClientApplicationBuilder.Create(clientId)
.WithAuthority(authority)
.WithRedirectUri(redirectUri)
.Build();

Which value should you assign to the `authority` variable?

  1. A
    https://login.microsoftonline.com/common
  2. https://login.microsoftonline.com/organizationsCevap
  3. C
    https://login.microsoftonline.com/consumers
  4. D
    https://login.microsoftonline.com/tenants

Cevap

https://login.microsoftonline.com/organizations
The authority endpoint https://login.microsoftonline.com/organizations is designed specifically for multi-tenant applications that only allow work or school accounts from Microsoft Entra ID tenants, thereby excluding personal Microsoft accounts.

Adım Adım Çözüm

1
Analyze the tenant requirements for the application.
The application must support multi-tenant authentication for all Microsoft Entra ID directories, but must exclude personal Microsoft accounts.
This filters the choice of authority endpoints based on audience type.
2
Evaluate the standard Microsoft Identity Platform v2.0 authority endpoints.
The endpoint ending in '/organizations' targets work or school accounts from any tenant, while '/common' includes personal accounts, and '/consumers' includes only personal accounts.
Choosing the correct endpoint ensures compliance with the target user audience constraints.
3
Assign the correct endpoint URI to the authority configuration in MSAL.NET.
Setting the authority to 'https://login.microsoftonline.com/organizations' completes the client application configuration correctly.
This passes the correct target audience to the client application builder.

Anahtar Kavram

Microsoft Identity Platform multi-tenant authority endpoints
Tahmini Süre:1m 30s
Bu soruyu puanla