Courseiva

AI-102 Implement an agentic solution Practice Question

You are developing an agent by using the Azure AI Foundry Agent Service. The agent must query a proprietary internal REST API that returns JSON data. The API requires an OAuth 2.0 access token for authentication. You need to configure the agent to call this API. What should you do?

⚠ Common exam trap

The trap here is assuming that function calling definitions can handle authentication, but they only describe the API schema and do not manage credentials securely.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Configure an OpenAPI tool for the agent, specifying the API's OpenAPI specification and setting up an OAuth 2.0 connection for authentication.

The agent must call an OAuth-protected REST API. Azure AI Foundry Agent Service supports OpenAPI tools, which allow you to import an API specification and configure OAuth 2.0 authentication. This enables the agent to securely call the API, with the service handling token acquisition and refresh. Other options either lack secure authentication support or are not designed for dynamic API invocation.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Configure an OpenAPI tool for the agent, specifying the API's OpenAPI specification and setting up an OAuth 2.0 connection for authentication.

    Why this is correct

    OpenAPI tools in Azure AI Foundry Agent Service allow you to import an API specification and configure authentication, including OAuth 2.0. This provides a secure, managed way for the agent to call the API, handling token acquisition and refresh automatically. This is the recommended approach for integrating external REST APIs with OAuth.

  • ✗

    Use the Azure AI Foundry SDK to programmatically inject the OAuth token into each request by using a custom middleware component.

    Why it's wrong here

    While programmatic token injection is possible in custom code, it requires managing token lifecycle, storage, and refresh manually, which increases complexity and risk. The Agent Service provides built-in support for OAuth via OpenAPI tools, eliminating the need for custom middleware and reducing security vulnerabilities.

  • ✗

    Add the API endpoint as a knowledge source in Azure AI Search and use integrated vectorization to index the JSON responses.

    Why it's wrong here

    Azure AI Search is designed for indexing and retrieving static or semi-static content, not for making dynamic, authenticated API calls. The agent needs to invoke the API in real time with proper OAuth tokens, which search indexing cannot provide. This approach would also expose sensitive data in the search index.

  • ✗

    Create a custom tool by using a function calling definition that includes the API endpoint and authentication details, and register it with the agent.

    Why it's wrong here

    Function calling definitions describe the API schema for the model to invoke, but they do not securely store or manage OAuth 2.0 tokens. Authentication credentials should not be embedded in the function definition because they would be exposed in logs or agent configuration. A more secure, managed connection is required for OAuth-protected APIs.

About these practice questions

Courseiva writes every AI-102 question from scratch — 761 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Microsoft exam blueprint

This AI-102 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AI-102 exam.