Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Configure authentication mechanisms

A worked example

Multiple answers

You deploy a C# application that reads items from an Azure Cosmos DB for NoSQL account to Azure App Service. The following conditions apply:

  • A user-assigned managed identity named id-catalog already has the required data-plane role on the account. It is not yet attached to the App Service app.
  • The app has no system-assigned identity, and only id-catalog must be used to authenticate.
  • In production, the code must not fall back to a developer credential or any other credential source.
  • The app must not use an account key.

During development, the code used DefaultAzureCredential and succeeded with a developer's Azure CLI sign-in.

You need the deployed app to authenticate to Azure Cosmos DB. Which two actions should you perform? Each correct answer presents part of the solution. Select two.

Choose 2 answers.
Why

Two separate things are needed: the host must expose id-catalog to the app, and the code must request a token for that specific identity. An explicit ManagedIdentityCredential built from the user-assigned client ID does the second and avoids the fallback behavior of DefaultAzureCredential's chain. A system-assigned credential targets a different principal, and an account key is not permitted.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free