Course menuAI-901

Exams / AI-901 / Chat client apps with the Foundry SDK / Question 4

AI-901 practice question: Chat client apps with the Foundry SDK (4 of 4)

Implement AI solutions by using Microsoft Foundry A free question from our original AI-901 practice exam. Try it, then open the answer to see why each option is right or wrong.

Last verified against current Microsoft Learn ·How we write our questions

A regional clinic network is building an app that calls a Foundry agent. The app runs on developers' laptops during testing and on an Azure virtual machine in production. The security team forbids storing secret keys in source code, configuration files or environment variables.

The agent client requires Microsoft Entra sign-in.

Which authentication approach meets these requirements?

Choose one answer.

  1. A. A resource key pasted into the client constructor, which the team rotates every quarter
  2. B. An API key stored in an environment variable and read by AzureKeyCredential
  3. C. DefaultAzureCredential, which uses az login locally and the VM's managed identity in Azure
  4. D. Anonymous access, with the agent endpoint left open so that no sign-in is needed
Show the answer and explanation

Answer: C

  • A. Wrong: A resource key is a shared secret, and the agent client needs a Microsoft Entra identity rather than a key. Pasting the key into code also breaks the security rule.
  • B. Wrong: An environment variable is still a stored secret, which the security team forbids. Key-based credentials also fail the agent client's Microsoft Entra requirement.
  • C. Right: Correct. DefaultAzureCredential tries a chain of credentials, using the developer's az login session on a laptop and a managed identity when the app runs on an Azure host with one enabled. No secret is stored, and the agent client gets the Entra sign-in it requires. Learn more: Credential chains in the Azure Identity library for Python (opens in a new tab)
  • D. Wrong: Removing sign-in would let any caller reach the agent and its tools, which the security team cannot accept. The agent client expects a Microsoft Entra identity, so this option fails both needs.

Explanation

Agent clients in Foundry require Microsoft Entra ID rather than keys. DefaultAzureCredential picks up the developer's az login session during testing and the VM's managed identity in production, so no secret is stored anywhere.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

Want more on Chat client apps with the Foundry SDK? The 5 full-length practice sets have 20 more Chat client apps with the Foundry SDK questions, 225 in all, none of them in the free exam. One payment of $9.99 $6.99, no subscription. Get the practice sets

Every exam starts with free questions. No account needed.