Microsoft Identity Platform and MSAL · AZ-204: Developing Solutions for Microsoft Azure Implement Azure Security

A background Azure App Service must call a protected Azure resource without a signed-in user. The service is registered as a confidential client and…

Practice question from Microsoft Identity Platform and MSAL (AZ-204: Developing Solutions for Microsoft Azure Implement Azure Security), with the correct answer and a step-by-step solution.

medium · MCQ · Q-04C40D

A background Azure App Service must call a protected Azure resource without a signed-in user. The service is registered as a confidential client and has been granted application permission to the resource. Which MSAL.NET call and scope format should it use?

  1. A.AcquireTokenInteractive(new[] { "https://resource-api/.default" })
  2. B.AcquireTokenForClient(new[] { "https://resource-api/.default" })Correct answer
  3. C.AcquireTokenOnBehalfOf(new[] { "https://resource-api/.default" }, userAssertion)
  4. D.AcquireTokenSilent(new[] { "https://resource-api/User.Read" }, null)

Solution

The client-credentials flow is used when a daemon or service acts without a user. In MSAL.NET, a confidential client calls AcquireTokenForClient, and the resource/.default scope requests the statically configured application permissions for that resource.

More from Microsoft Identity Platform and MSAL

All of Microsoft Identity Platform and MSAL

Practise more Implement Azure Security

Sign up free for adaptive practice on this chapter, with instant feedback and hints on every question.

Start practising free

Free to start · No credit card needed