Skip to content

AI-901 · Domain 2: Implement AI solutions by using Microsoft Foundry · 58% of the exam

Task 2.1: Implement generative AI apps and agents by using Foundry

Writing system and user prompts, deploying and testing a model in the Foundry portal, a small chat client with the Foundry SDK, and building, testing and calling a single agent.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the Microsoft documentation page that proves it.

Question 1 · choose 1

A developer is building a homework helper on a deployed chat model. In every conversation the model must act as a patient math tutor for 12-year-olds, give hints instead of full solutions and decline unrelated topics. Students type their own questions. Where should these rules go?

  1. AIn each user prompt, typed by the students along with their question
  2. BIn a fine-tuning dataset used to retrain the model before launch
  3. CIn the system prompt that the application sends with each request
  4. DIn the deployment's tokens-per-minute rate limit settings
Show the answer and why
  • AIn each user prompt, typed by the students along with their question

    Incorrect

    User prompts carry the student's own request. Relying on students to repeat the rules is unreliable, and they could simply leave them out.

  • BIn a fine-tuning dataset used to retrain the model before launch

    Incorrect

    Retraining isn't needed to set a role and a few rules. The system prompt handles that without any training data.

  • CIn the system prompt that the application sends with each request

    Correct

    The system prompt sets the role, tone and constraints the model follows for the whole conversation, and the application controls it, not the student.

  • DIn the deployment's tokens-per-minute rate limit settings

    Incorrect

    Rate limits control how much traffic a deployment accepts. They have no effect on how the model behaves or what it says.

System prompts set the behavior, tone and constraints of the model and are usually set by the application. User prompts carry the specific question, and the model answers them while following the system prompt.

Question 2 · choose 1

An internal benefits assistant adds retrieved policy excerpts to each prompt before calling the model. Testers find that when no excerpt covers a question, the model fills the gap with plausible but invented details. Which change to the instructions is most likely to help?

  1. ATell the model to answer from the excerpts and to say when they don't contain the answer
  2. BRaise the temperature so the model considers a wider range of possible answers
  3. CStop sending the excerpts so the model answers from what it learned in training
  4. DTell the model to sound confident and give a full answer each time a question is asked
Show the answer and why
  • ATell the model to answer from the excerpts and to say when they don't contain the answer

    Correct

    Grounding instructions plus an explicit fallback tell the model what to do when the context is insufficient, instead of guessing.

  • BRaise the temperature so the model considers a wider range of possible answers

    Incorrect

    A higher temperature makes output more random. It makes invented details more likely, not less.

  • CStop sending the excerpts so the model answers from what it learned in training

    Incorrect

    The model's training doesn't include the company's private policies, so removing the excerpts removes the facts it needs.

  • DTell the model to sound confident and give a full answer each time a question is asked

    Incorrect

    Pushing for confident, complete answers encourages the model to fill gaps rather than admit that the information is missing.

A grounded prompt includes the retrieved content plus instructions to answer from it, acknowledge when it's insufficient and cite sources. Telling the model what to do when it lacks information is a key part of a reliable system message.

Question 3 · choose 1

A developer deployed a model in the Foundry portal, then tuned the system prompt and parameter values in the model playground until the answers looked right. What's the quickest way to start a Python client that uses the same deployment and settings?

  1. ARun the AI Red Teaming Agent against the deployment and reuse its generated attack prompts as code
  2. BCopy the generated Python sample from the playground's code view, or open it in VS Code
  3. CSave the playground chat as an evaluation dataset and run an evaluation against the deployment
  4. DWrite REST calls from scratch by reading the API reference and copying the key from the Azure portal
Show the answer and why
  • ARun the AI Red Teaming Agent against the deployment and reuse its generated attack prompts as code

    Incorrect

    The AI Red Teaming Agent probes a deployment with adversarial prompts to find safety risks. It doesn't produce a client application.

  • BCopy the generated Python sample from the playground's code view, or open it in VS Code

    Correct

    The playground exports multilingual code samples for the deployment and settings you tested, and Open in VS Code imports the sample, endpoint and key for you.

  • CSave the playground chat as an evaluation dataset and run an evaluation against the deployment

    Incorrect

    Evaluations score quality and safety of outputs. They're a useful next step, but they don't give you client code.

  • DWrite REST calls from scratch by reading the API reference and copying the key from the Azure portal

    Incorrect

    Calling the REST API directly works, but it's slower and you must recreate the settings by hand; the playground already generates matching code.

The model playground is a bridge between experimentation and code. After you test prompts and parameters, its code view gives you a sample that calls your deployment with the same settings, which you can use as the start of a lightweight client.

Question 4 · choose 1

A team deploys the gpt-5-mini model in a Foundry project and names the deployment "support-chat". In their Python code that calls the Responses API, what value should they pass as the model parameter?

  1. A"gpt-5-mini", the name of the underlying model
  2. B"2025-08-07", the version of the deployed model
  3. CThe name of the Foundry project that contains the deployment
  4. D"support-chat", the name of the deployment
Show the answer and why
  • A"gpt-5-mini", the name of the underlying model

    Incorrect

    The base model name only works if the deployment happens to have the same name. Here it was named "support-chat".

  • B"2025-08-07", the version of the deployed model

    Incorrect

    The version is a property of the deployment, not the identifier you put in the request.

  • CThe name of the Foundry project that contains the deployment

    Incorrect

    The project is identified by the endpoint URL. The model parameter names the deployment to call.

  • D"support-chat", the name of the deployment

    Correct

    Requests name the deployment you created, which can differ from the underlying model's name.

When you deploy a model you give the deployment a name, and requests refer to that deployment name. If you don't customize it, it matches the model name, which is why the two are easy to confuse.

Question 5 · choose 1

A developer is writing a lightweight Python chat client with the Foundry SDK (the azure-ai-projects package) for a model deployed in a Foundry project. Which code pattern matches how the SDK is designed to be used?

  1. ACreate a TextAnalyticsClient with the resource endpoint and a key, then call its detect_language() method for each prompt
  2. BCreate a SpeechConfig with the resource key and endpoint, then start a SpeechRecognizer that listens to the microphone
  3. CCreate an AIProjectClient with the project endpoint, call get_openai_client(), then call responses.create()
  4. DCreate a ContentUnderstandingClient, then call begin_analyze() with an analyzer ID for each prompt
Show the answer and why
  • ACreate a TextAnalyticsClient with the resource endpoint and a key, then call its detect_language() method for each prompt

    Incorrect

    TextAnalyticsClient belongs to the Azure Language SDK and runs fixed text analysis tasks. It doesn't chat with a deployed model.

  • BCreate a SpeechConfig with the resource key and endpoint, then start a SpeechRecognizer that listens to the microphone

    Incorrect

    SpeechConfig and SpeechRecognizer come from the Speech SDK and turn spoken audio into text. They don't send prompts to a chat model.

  • CCreate an AIProjectClient with the project endpoint, call get_openai_client(), then call responses.create()

    Correct

    The Foundry SDK connects to the project endpoint and hands you an OpenAI-compatible client for calling deployed models through the Responses API.

  • DCreate a ContentUnderstandingClient, then call begin_analyze() with an analyzer ID for each prompt

    Incorrect

    ContentUnderstandingClient runs Content Understanding analyzers on documents and media. It isn't used for chatting with a model.

The Foundry SDK exposes a project client for Foundry operations and an OpenAI-compatible client for calling models with the Responses API; most apps use both. A typical lightweight client creates the project client, gets the OpenAI client and calls responses.create().

Question 6 · choose 1

A prototype chat client authenticates to a Foundry project with an API key pasted into the script. Before production, the security team asks for no secrets in the code, traceability to individual users and services, and least-privilege access. What should the developer change?

  1. AUse Microsoft Entra ID through DefaultAzureCredential and assign the identity a Foundry role
  2. BKeep the API key in the script but rotate it to a new value each week in the portal
  3. CMove the API key into a .env file and load it with load_dotenv() when the script starts
  4. DChange the model deployment to the Data Zone Standard type so requests stay inside a data zone
Show the answer and why
  • AUse Microsoft Entra ID through DefaultAzureCredential and assign the identity a Foundry role

    Correct

    Entra ID removes the key from the code and supports managed identities, conditional access and granular role-based access, which Microsoft recommends for production.

  • BKeep the API key in the script but rotate it to a new value each week in the portal

    Incorrect

    Rotation limits how long a leaked key is useful, but the secret stays in the code and a shared key still can't tell users apart.

  • CMove the API key into a .env file and load it with load_dotenv() when the script starts

    Incorrect

    A .env file keeps the key out of the source text, which is fine for prototypes, but it's still one shared key with coarse access and no per-user traceability.

  • DChange the model deployment to the Data Zone Standard type so requests stay inside a data zone

    Incorrect

    Data Zone deployment types control where inference is processed. They don't change how the client authenticates.

Foundry supports Microsoft Entra ID and API keys. Keys are convenient for quick evaluation but give coarse access without per-user traceability; Entra ID with role assignments is the recommended choice for production.

Question 7 · choose 1

An HR team has a deployed model that answers general leave policy questions in the playground. They now want it to look up an employee's remaining leave balance in the HR system and submit leave requests on the employee's behalf. What must they add to turn this into an agent?

  1. AA longer system prompt that describes the HR system and its data in detail
  2. BTools that let the model call the HR system to read data and take actions
  3. CA higher maximum output token limit for longer and fuller answers
  4. DA second deployment of the same model in another Azure region
Show the answer and why
  • AA longer system prompt that describes the HR system and its data in detail

    Incorrect

    A description of the HR system shapes how the model talks about it, but text alone can't read live data or submit anything.

  • BTools that let the model call the HR system to read data and take actions

    Correct

    An agent combines a model, instructions and tools. Tools are what let it act on external systems, such as reading a balance or submitting a request.

  • CA higher maximum output token limit for longer and fuller answers

    Incorrect

    Allowing longer responses changes their length, not the model's ability to reach the HR system.

  • DA second deployment of the same model in another Azure region

    Incorrect

    Another deployment adds capacity or resilience. It doesn't give the model any way to act.

Agents build on models: a model provides reasoning, instructions define the role, and tools let the agent call APIs, functions or other systems to retrieve information and take actions.

Question 8 · choose 1

A Python client calls a Foundry prompt agent. When a user asks a follow-up such as "And what about part-time staff?", the agent answers as if the earlier question never happened. Each call sends just the new question to the agent. What should the developer change?

  1. AAdd the agent's instructions to the start of each user message
  2. BCreate a new version of the agent before each question so its definition stays current
  3. CLower the temperature so the agent's answers stay consistent from one turn to the next
  4. DCreate a conversation once and pass its ID with each request to the agent
Show the answer and why
  • AAdd the agent's instructions to the start of each user message

    Incorrect

    Repeating instructions doesn't bring back the earlier question.

  • BCreate a new version of the agent before each question so its definition stays current

    Incorrect

    Agent versions capture changes to instructions, model or tools. A new version carries no conversation history.

  • CLower the temperature so the agent's answers stay consistent from one turn to the next

    Incorrect

    Temperature affects randomness in wording. It can't supply the missing earlier turn.

  • DCreate a conversation once and pass its ID with each request to the agent

    Correct

    A conversation stores the input and output items of earlier turns, so each new response runs with the history in context.

In Foundry Agent Service, an agent supplies reusable behavior, a conversation persists history across turns, and a response is one unit of execution. Reusing the same conversation is what lets the agent answer follow-up questions in context.

Question 9 · choose 2

A finance team is building a single agent in the Foundry portal. It must calculate growth rates and draw charts from CSV files that users upload, and it must answer questions about competitors' announcements from the past week. Which two tools should the team add? (Choose TWO.)

  1. ACode Interpreter, for the calculations and charts
  2. BFunction calling, for the recent competitor announcements
  3. CWeb search, for the recent competitor announcements
  4. DImage generation, for the charts
  5. EA Content Understanding analyzer, for the growth rate calculations
Show the answer and why
  • ACode Interpreter, for the calculations and charts

    Correct

    Code Interpreter lets the agent write and run Python in a sandbox for data analysis and chart generation on uploaded files.

  • BFunction calling, for the recent competitor announcements

    Incorrect

    Function calling would need the team to write and host code that fetches announcements. Web search returns current public results directly.

  • CWeb search, for the recent competitor announcements

    Correct

    Web search grounds answers in current public web content with inline citations, which suits last week's announcements.

  • DImage generation, for the charts

    Incorrect

    Image generation creates pictures from prompts. It doesn't compute values from the CSV data, so the charts wouldn't be accurate.

  • EA Content Understanding analyzer, for the growth rate calculations

    Incorrect

    Content Understanding extracts structured data from content. It doesn't calculate growth rates or draw charts.

Match each requirement to a tool: Code Interpreter runs Python for data analysis and charts, and web search brings in current public information.

Question 10 · choose 2

A marketing lead prompts a model with "Write about our new trail running shoe" and gets long, generic text that can't be used. Which two changes to the prompt are most likely to produce usable product copy? (Choose TWO.)

  1. ARaise the temperature to the top of its range for more creative writing
  2. BState the audience, tone, format and length, such as three short bullet points for beginner trail runners
  3. CLeave out product details so the model isn't constrained by them
  4. DInclude a short example of existing copy written in the style you want
  5. EAdd the words "be original" to the end of the prompt
Show the answer and why
  • ARaise the temperature to the top of its range for more creative writing

    Incorrect

    A very high temperature makes output more random. It doesn't fix missing information about audience and format.

  • BState the audience, tone, format and length, such as three short bullet points for beginner trail runners

    Correct

    Clear, specific prompts that give the audience and the format you want produce more relevant, usable output than vague requests.

  • CLeave out product details so the model isn't constrained by them

    Incorrect

    Leaving out context gives the model less to work with, which tends to make the copy more generic.

  • DInclude a short example of existing copy written in the style you want

    Correct

    An example (one-shot or few-shot) shows the model the style and shape of output you expect for this request.

  • EAdd the words "be original" to the end of the prompt

    Incorrect

    A vague instruction adds no audience, format or content to work from. Specific instructions work better than general ones.

Better prompts are clear and specific, add context such as topic, audience and format, ask for structure, and use examples to show the style you want. The examples condition the model for that request without changing it permanently.

Question 11 · choose 1

A developer calls a Foundry project endpoint directly over REST instead of using an SDK. What does a typical request consist of?

  1. AA URL whose query string carries the API key and the prompt text
  2. BHeaders with authentication, plus a JSON body with the model and input
  3. CAn SSML document that describes how the model should speak
  4. DA binary gRPC message that carries the key and the prompt
Show the answer and why
  • AA URL whose query string carries the API key and the prompt text

    Incorrect

    The URL identifies the endpoint and API version. The key or token goes in a header, and the prompt goes in the JSON body.

  • BHeaders with authentication, plus a JSON body with the model and input

    Correct

    REST requests carry metadata such as authentication in headers and the data, such as the model and prompt, in a JSON body.

  • CAn SSML document that describes how the model should speak

    Incorrect

    SSML is for text to speech, not for sending prompts to a model.

  • DA binary gRPC message that carries the key and the prompt

    Incorrect

    Foundry endpoints expose REST interfaces: HTTP requests with headers and a JSON body, and JSON responses.

Applications talk to Foundry endpoints with REST requests: headers hold metadata such as authentication and data format, and a JSON body holds the data. Responses also come back as JSON. SDKs build these calls for you.

Question 12 · choose 1

A student builds a lightweight chat client for a model deployed in Foundry. Which description fits a lightweight client application?

  1. AAn app that downloads the model's weights and runs inference on the user's laptop
  2. BA large web platform with its own databases, queues and user management
  3. CA script that trains a new model each time a user asks a question
  4. DA small app that sends input to the remote model and shows the result
Show the answer and why
  • AAn app that downloads the model's weights and runs inference on the user's laptop

    Incorrect

    Running the model locally is a different pattern; a lightweight client calls a remote service.

  • BA large web platform with its own databases, queues and user management

    Incorrect

    Heavy backends and frameworks are what a lightweight client avoids.

  • CA script that trains a new model each time a user asks a question

    Incorrect

    Clients send requests for inference; they don't train models.

  • DA small app that sends input to the remote model and shows the result

    Correct

    Lightweight clients keep state and compute mostly on the server, with a small code footprint and minimal configuration.

A lightweight client is a small, minimal app, such as a single Python file or CLI, that collects input, calls a remote API and displays results, leaving the model and heavy work on the server.

Question 13 · choose 1

A Python script calls openai.responses.create() through the Foundry SDK and needs to print just the text the model generated. Which property of the response should it print?

  1. Aiso6391_name
  2. Bprimary_language
  3. Cmarkdown
  4. Doutput_text
Show the answer and why
  • Aiso6391_name

    Incorrect

    iso6391_name holds a language code in Azure Language language detection results.

  • Bprimary_language

    Incorrect

    primary_language belongs to Azure Language language detection results.

  • Cmarkdown

    Incorrect

    markdown appears in Content Understanding analysis results, not in Responses API output.

  • Doutput_text

    Correct

    output_text gives the generated text of the response, as the Foundry quickstart samples show.

The Responses API returns a response object whose output_text property holds the generated text, which is what a simple chat client prints or shows to the user.

Question 14 · choose 1

A company designs a solution in which one agent gathers sales data, another analyzes it and a third drafts and sends a weekly report. What kind of design is this?

  1. AA multi-agent system of specialized, collaborating agents
  2. BA single model call with a very long system prompt
  3. CA batch deployment that processes reports overnight
  4. DA retrieval index shared by several chat apps
Show the answer and why
  • AA multi-agent system of specialized, collaborating agents

    Correct

    In multi-agent systems, several agents with their own specialties work together, communicating through prompts.

  • BA single model call with a very long system prompt

    Incorrect

    One model call doesn't divide the work among specialized agents.

  • CA batch deployment that processes reports overnight

    Incorrect

    A batch deployment is a model deployment type, not a way of splitting work across agents.

  • DA retrieval index shared by several chat apps

    Incorrect

    A shared index supplies knowledge but doesn't describe agents working together.

Instead of one agent doing everything, multiple agents can collaborate, each with its own specialty: one gathers data, another analyzes it and a third takes action, much like a human team.

Practise domain 2 →Practise all domains →