Domain 2: Implement AI Solutions by Using Microsoft Foundry (Part 1 of 3)
This lesson covers 5 exam topics: Microsoft Foundry Essentials, Writing System and User Prompts, Deploying and Testing a Model in the Portal, Building a Chat Client with the Foundry SDK, Creating a Single Agent in the Portal. Each topic has a short video, then the notes: key facts, exam traps and what to check in the official docs.
1. Microsoft Foundry Essentials
Central question: What is Microsoft Foundry, and which surface do you use for what?
What Foundry is
- Unifies agents, models and tools under one management grouping, with tracing, monitoring, evaluations, and unified RBAC, networking and policies under one Azure resource provider.
- Models: 10,000+ models in the Foundry Models catalog. Agents: Foundry Agent Service. Tools and knowledge: built-in tools, memory, retrieval.
- Foundry Tools include Azure Language, Azure Speech, Azure Vision and Azure Content Understanding, available through a Foundry resource.
- A Foundry resource with projects; your code connects through a project endpoint (format
https://<resource>.services.ai.azure.com/api/projects/<project>).
Developer surfaces
| Surface | Best for |
|---|---|
| Foundry portal | Exploring models, prototyping prompts in playgrounds, building prompt agents without code |
| SDKs (Python, C#, JavaScript, Java) | Building applications |
| Azure Developer CLI (azd) | Scaffolding and deploying hosted agent projects |
| Visual Studio Code | Building and debugging agents in the editor |
Hub-based projects remain in the Foundry (classic) portal; new investment is in Foundry projects (verified).
Exam traps
- Separate keys and endpoints for every capability. One project endpoint gives access to project APIs.
- Code required for prototyping. Playgrounds and prompt agents need none.
- Confusing the Foundry resource and a project. Projects live in a Foundry resource.
2. Writing System and User Prompts
Central question: How do you write prompts that produce reliable output?
Two kinds of message
- System message: instructions that set the model's role, rules, tone and output format for the whole conversation.
- User prompt: the request or data for this turn.
- Few-shot examples: example user and assistant pairs after the system message; they condition the model for the current inference only. Prompts without examples are zero-shot.
Techniques (verified where noted; others general background)
| Technique | Example |
|---|---|
| Clear instructions and role | "You are a support agent for Contoso. Answer only about our products." |
| Specify output format | "Return JSON with fields: issue, urgency." |
| Few-shot examples (verified) | Two sample ticket→category pairs |
| Ground in data | Paste or retrieve the relevant document; "answer only from the text below" |
| Break tasks into steps | Extract facts first, then write the answer |
| Set boundaries | What to do when the answer isn't known |
Microsoft notes you must still validate responses: a prompt that works for one scenario may not generalize (verified).
Exam traps
- Putting role and rules in every user message instead of the system message.
- Believing few-shot changes the model permanently.
- No instruction for unknown answers, inviting hallucinations.
3. Deploying and Testing a Model in the Portal
Central question: How do you deploy a model in Foundry and try it out?
Steps (portal flow; general background built on verified features)
- Open your project in the Foundry portal.
- Browse the model catalog; compare capabilities, cost and region support.
- Deploy the model: choose a deployment name and deployment type (start with Global Standard) (lesson 05).
- Open the playground: set the system message, adjust parameters (temperature, max tokens), and chat.
- Use View code to copy sample code for your app.
Facts to know
- Instant access (preview) lets you call some models by name without creating a deployment.
- Not all models support all deployment types; check availability by region.
- In code, you reference the deployment name (or model name for instant access).
Exam traps
- Calling a model by its catalog name when your code needs your deployment name.
- Testing only one prompt. Try several realistic prompts before building.
- Provisioned deployment for a prototype.
4. Building a Chat Client with the Foundry SDK
Central question: What is the minimum code to chat with a Foundry model?
Verified Python pattern
1# pip install "azure-ai-projects>=2.3.0"2from azure.identity import DefaultAzureCredential3from azure.ai.projects import AIProjectClient4 5project = AIProjectClient(endpoint=PROJECT_ENDPOINT, credential=DefaultAzureCredential())6openai = project.get_openai_client()7response = openai.responses.create(model=DEPLOYMENT_NAME, input="Summarize our refund policy.")8print(response.output_text)| Piece | Role |
|---|---|
| azure-ai-projects (Foundry SDK) | Thin client to all project APIs through one project endpoint |
| DefaultAzureCredential | Microsoft Entra ID sign-in (no keys in code) |
| get_openai_client() | OpenAI-compatible client bound to the project |
| responses.create | Calls the model (Responses API) |
Making it a chat client (general background)
Loop: read user input → send it (with history or a conversation) → print the reply. Add a system instruction for role and rules.
Exam traps
- Hard-coding API keys. Prefer Entra ID with DefaultAzureCredential.
- Wrong endpoint. Use the project endpoint, not a random service URL.
- Forgetting history. Without it, each turn is independent.
5. Creating a Single Agent in the Portal
Central question: How do you build and test one agent in Foundry without code?
Foundry Agent Service
- An agent is a model + instructions + tools that reasons over requests and takes action.
- Prompt agents: defined entirely by configuration (instructions, model, tools); Foundry runs them with no code or containers. Fastest path.
- Other types: voice-based prompt agents (via Voice Live) and hosted agents (your own code as a container).
- Toolboxes: web search, file search, code interpreter, MCP servers, custom functions.
- Portal-first path: create the agent, test it in the playground, then call it from code.
Steps (general background on verified features)
- Create an agent in the project; name it.
- Pick a deployed model.
- Write instructions (role, scope, tone, what to refuse).
- Add tools/knowledge (e.g. file search over uploaded documents).
- Test in the playground; refine instructions; save a version.
Exam traps
- Hosted agent for a simple FAQ agent. A prompt agent needs no code.
- No knowledge attached, then expecting company-specific answers.
- Skipping playground testing.
References
- AI-901 study guide — checked Oct 21, 2026
- What is Microsoft Foundry — checked Oct 21, 2026
- Foundry SDKs and endpoints — checked Oct 21, 2026
- Prompt engineering techniques — checked Oct 21, 2026
- Deployment types — checked Oct 21, 2026
- Get started with code — checked Oct 21, 2026
- Agents in Foundry — checked Oct 21, 2026
Check your understanding
Try prompts against a model without writing code?Show answerHide answer
Answer
Foundry portal playground.Where do persistent rules go?Show answerHide answer
Answer
The system message.Where do you experiment with prompts and parameters?Show answerHide answer
Answer
The playground.Package for the Foundry SDK in Python?Show answerHide answer
Answer
azure-ai-projects.Agent type with no code or infrastructure?Show answerHide answer
Answer
Prompt agent.