Skip to main content

AI-200 practice question · Connect to and Consume Azure Services

A .NET application calls the Azure OpenAI SDK client types directly from dozens of business classes.

A .NET application calls the Azure OpenAI SDK client types directly from dozens of business classes. The team wants to be able to move some features to a different model provider later without changing those classes, and to add telemetry and caching in one place. What should they do?

  • AHave business classes depend on the IChatClient interface from Microsoft.Extensions.AI and register a provider-specific implementation through dependency injection
  • BStore the Azure OpenAI endpoint and deployment name in Azure App Configuration so the business classes can switch models without being redeployed
  • CWrap every Azure OpenAI SDK call in the business classes with a shared retry and circuit-breaker resilience policy
  • DHave business classes depend on the IEmbeddingGenerator interface from Microsoft.Extensions.AI and send chat prompts through it
Show the answer and explanation

Correct answer: A) Have business classes depend on the IChatClient interface from Microsoft.Extensions.AI and register a provider-specific implementation through dependency injection

Microsoft.Extensions.AI provides IChatClient, a provider-neutral abstraction. Business code that depends on it can switch model providers through dependency injection, and cross-cutting middleware such as telemetry and caching can be added in one place.

Why each option is right or wrong

  • A) Correct. IChatClient is a provider-neutral chat abstraction. Microsoft Learn recommends coding against these abstractions instead of hardcoding to one AI service, which gives portability across models and services. The Microsoft.Extensions.AI package also lets you add middleware such as OpenTelemetry and caching to the client pipeline.
  • B) Incorrect. Moving settings into configuration lets the team change deployments within Azure OpenAI, but the business classes still use Azure OpenAI SDK types. Switching to another provider would still mean changing every class.
  • C) Incorrect. Resilience policies deal with transient failures. They don't remove the direct dependency on Azure OpenAI client types, so the provider coupling stays.
  • D) Incorrect. IEmbeddingGenerator is the abstraction for generating embeddings, not for chat. Chat interactions use IChatClient.
Exam domain
Connect to and Consume Azure Services · 25% of AI-200
Question type
Multiple choice (one answer)

Practise the full AI-200 exam

This question is one of a small free sample from the CertRidge AI-200 bank. Full practice exams match the real exam's length, time limit and domain weights, explain every option, and Review Mode re-drills the questions you miss.

Original question written from the official exam guide. Not affiliated with Microsoft; never copied from the real exam.