Configuring Guardrails in Foundry
This lesson explains the structure of a guardrail, where it intervenes, and how assignment works.
Learning outcomes
After completing this lesson, you will be able to:
- Describe a guardrail and its controls.
- Identify the intervention points.
- Match a risk to an intervention point.
- Explain how guardrails override.
What a guardrail is
A guardrail in Microsoft Foundry is a named collection of controls. Each control defines three things: a risk to detect, the intervention points at which to check for it, and the action to take. A single guardrail can be applied to many models and agents, so that a security team can define a standard and reuse it.
Guardrails address what a model says and what an agent does at each stage. They do not replace identity and network controls, because they examine content rather than access.
Intervention points
An agent interaction has more stages than a simple chat, and each one is a place where something can go wrong. The following table shows the four points.
| Intervention point | Applies to | What it examines | Why it matters |
|---|---|---|---|
| User input | Models and agents | The prompt that the user sends | Stops direct attacks and harmful requests |
| Tool call (Preview) | Agents only | The call that the agent plans to make | Stops sensitive data from leaving through a tool |
| Tool response (Preview) | Agents only | What the tool returns | Stops hidden instructions in retrieved content |
| Output | Models and agents | The final response | Stops harmful or sensitive content from reaching users |
The tool response point is especially important for indirect prompt injection. When an agent fetches a web page or document that contains hidden instructions, this is the point at which they enter the conversation. A model deployment has no tools, which is why these two points apply to agents only.
The following diagram places the four intervention points in an agent interaction.

Intervention points
Risks
The following table shows the risks that a control can address, and whether each one applies to models, to agents, or to both.
| Risk | Models | Agents (Preview) | What it does |
|---|---|---|---|
| Hate, Sexual, Self-harm, Violence | Yes | Yes | Blocks harmful content at a level of Off, Low, Medium or High |
| User prompt attacks | Yes | Yes | Detects direct jailbreak attempts |
| Indirect attacks | Yes | Yes | Detects instructions hidden in documents and other content |
| Spotlighting (Preview) | Yes | No | Marks untrusted input so that a model can treat it as data |
| Protected material | Yes | Yes | Detects known text and code |
| Groundedness (Preview) | Yes | No | Checks whether a response is supported by its source |
| PII (Preview) | Yes | Yes | Detects personally identifiable information |
| Task adherence (Preview) | Yes | Yes | Detects when actions depart from the intended task |
Two actions are available. Annotate records a finding without blocking, and it applies to models only. Annotate and block records the finding and stops the content. The groundedness feature for Azure OpenAI retires on 30 April 2027, so check Microsoft Learn before designing around it.
Guardrail risks and actions
Assignment
How a guardrail reaches a model or agent decides what actually protects a workload, and this is frequently tested.
- Models receive the default guardrail
Microsoft.DefaultV2unless another one is assigned. - If no custom guardrail is assigned to an agent, it inherits the guardrail of its model deployment.
- If an agent has its own guardrail, that guardrail fully overrides the model's guardrail. They do not combine.
- One guardrail can be applied to many models and agents.
- Guardrails apply only to agents built in Foundry Agent Service, not to other agents registered in the Foundry control plane.
Override, not merge
Because an agent's guardrail overrides rather than adds to the model's guardrail, assigning a narrow custom guardrail to an agent can silently remove protections that it used to inherit. Include every control that the agent needs.
Which guardrail applies?
Designing a guardrail
A strong agent guardrail places controls at each relevant point. Prompt attacks are checked on user input, indirect attacks on tool responses, PII on tool calls and outputs, and task adherence where an agent might wander from its purpose. Hosted agents can also have egress controls, in preview, to limit where they can connect, and these are configured in the same guardrail.
Start strict for agents with tools, test with representative content, and adjust where false positives occur. Log blocked events, since a surge can indicate an attack. Guardrails reduce risk but do not remove it, so continue to apply least privilege to the agent's identity.
A guardrail for a research agent
A Foundry agent reads pages from the public web and can email reports. The security team is concerned about hidden instructions in web pages and about personal data leaving through email. The agent's model deployment already has a strict custom guardrail. A developer proposes assigning a new guardrail to the agent, with only a PII control. What should you advise?
The concern about hidden instructions calls for the indirect attacks risk at the tool response point. Personal data leaving through email calls for PII at the tool call point. The proposal is unsafe as it stands: an agent's guardrail fully overrides the model's, so a PII-only guardrail would remove all of the existing protections.
Include the model's existing controls in the agent's guardrail, along with these additions. Checking only user input would miss both threats, since neither comes from the user.
Why does the tool call intervention point not apply to a model deployment?
Show answer
A model on its own has no tools. Tool calls occur only in agents.
Exam Tips
Remember for the exam
- A control combines a risk, intervention points and an action.
- Tool call and tool response points apply to agents only.
- Use tool response to catch indirect prompt injection.
- An agent's guardrail fully overrides the model's guardrail.