AI-103 Responsible AI in Foundry: Guardrails, Safety Evaluations, Auditing and Agent Governance
Implementing responsible AI in Microsoft Foundry means putting controls around generative AI apps and agents so they don't produce harmful content, act on injected instructions or take actions nobody intended, and being able to prove it afterwards. In practice that is four jobs, matching the four skills of this task: configure guardrails that detect and block risks at the right intervention points; measure safety with risk and safety evaluators and red teaming; keep an audit trail through trace logging, provenance metadata and approval records; and govern agents with tool allow lists, approval workflows and alignment checks. This lesson explains how each control works, where it applies, and how near-identical options differ.
What you’ll learn
- Configure Foundry guardrails: choose risks, intervention points, blocking levels and annotate or block actions
- Detect user prompt and document attacks with Prompt Shields, including document delimiting and Spotlighting
- Assign guardrails to deployments, agents, hosted agents and individual requests, and predict which one applies
- Use groundedness detection, Task Adherence, risk and safety evaluators and the AI Red Teaming Agent, and read their explanations
- Build an audit trail with tracing, content recording settings, least-privilege log access and Content Credentials
- Govern agent tools with allowed_tools, require_approval, project connections and egress controls
The 10 parts · about 13 min of reading
- What are guardrails in Microsoft Foundry and how are they built?Start hereA guardrail (an RAI policy in ARM) pairs each risk with intervention points and an action; default guardrails can't be edited.1 min
- Which intervention point scans what?Models are scanned at user input and output; agents add tool call and tool response points, which work only for moderation-supported tools.1 min
- How do blocking levels and annotation modes work?Blocking levels name how much is blocked, so High is strictest; output annotate-only needs approval; PII and code modes are set per type.1 min
- How do Prompt Shields detect user prompt and document attacks?Prompt Shields split user prompt attacks from document attacks, which need the documents delimiter; Spotlighting adds base-64 encoding.1 min
- How are guardrails assigned to deployments, agents and single requests?raiPolicyName sets a deployment's guardrail, x-policy-id overrides per call, and an agent's own guardrail fully replaces the deployment's.1 min
- How do you configure guardrails and network egress for hosted agents?Hosted agents get safety from rai_config with a full ARM ID, need invocations_moderation on invocations, and egress rules in Audit first.2 min
- How do groundedness detection and Task Adherence detect risky output and actions?Groundedness detection checks output against sources, with correction; Task Adherence flags tool calls that don't match the user's request.1 min
- Which evaluators and tests measure an AI system's safety?Risk and safety evaluators score severity 0 to 7 against a threshold; the AI Red Teaming Agent reports Attack Success Rate from attacks.2 min
- How do you build an audit trail with tracing and provenance?Traces in Application Insights, logged approvals and C2PA Content Credentials on generated images form an AI system's audit trail.1 min
- How do you govern an agent's tools with approvals and access controls?allowed_tools limits MCP tools, require_approval pauses calls for review, and project connections keep MCP keys out of agent code.2 min
Mind map
How the exam tests this
Questions in this topic are Microsoft associate-style scenarios: a Foundry model deployment, prompt agent or hosted agent, a risk or audit requirement, and a constraint such as keeping a guardrail's other controls, still showing flagged content, covering tools added later, apps you can't change, unknown outbound hosts, or not storing customer content. Expect to pick a risk, intervention point, blocking level or annotate mode; explain why a guardrail doesn't take effect for an agent, a tool or a request; configure rai_config, invocations_moderation and egress rules for hosted agents; choose groundedness settings, a safety evaluator, a red-teaming setup or an explanation signal; and design tracing, log access, provenance checks, require_approval values, allowed_tools and credential handling. Some items complete short Python snippets, and several are select-two.
Key takeaways
- A guardrail is a set of controls, each a risk plus intervention points plus an action; Microsoft.DefaultV2 can't be edited, and core harm controls can be overridden but not deleted.
- Pick the intervention point where the risky content exists: tool call for data an agent sends out, tool response for content a tool returns, output for the reply. Tool controls work only on moderation-supported tools such as OpenAPI, not MCP.
- Blocking level Low blocks only high-severity content and High blocks low and up; annotate-only or Off on outputs needs approval for modified guardrails.
- Document attack detection is off by default and needs documents wrapped in the documents delimiter; Spotlighting is an optional, token-costly, Chat Completions-only add-on.
- An agent's own guardrail fully replaces its deployment's; raiPolicyName applies to every caller of a deployment, x-policy-id overrides for one request.
- Hosted agents need rai_config with a full ARM ID (empty rai_config means DefaultV2, none means no screening); the invocations protocol also needs invocations_moderation with a response_mode covering every reply shape.
- Harm evaluators score 0–7 with a default threshold of 3; ungrounded attributes needs context, and the agentic evaluators and red-team categories need agent runs in the cloud.
- Trace everything in production but turn content recording off; images from Azure OpenAI carry signed C2PA Content Credentials automatically.
- Restrict tools with allowed_tools, gate the rest with require_approval (a never list keeps future tools gated), and use Task Adherence to escalate only misaligned calls.
Part 1: What are guardrails in Microsoft Foundry and how are they built?
A guardrail (an RAI policy in ARM) pairs each risk with intervention points and an action; default guardrails can't be edited.
Frequently asked questions
What is the difference between a guardrail and a content filter in Microsoft Foundry?
A guardrail is Foundry's name for the content safety configuration applied to a model deployment or agent, and it replaces the older term content filter. A guardrail is a named collection of controls, where each control pairs a risk such as violence or prompt attacks with the intervention points it scans and the action to take. In Azure Resource Manager it is stored as an RAI policy.
Which blocking level should I choose in a Foundry guardrail?
Choose by how much you want blocked. Off blocks nothing, Low blocks only high-severity content, Medium blocks medium and high severity, and High blocks low, medium and high severity, making it the strictest. An app that must allow mild and moderate content in a harm category but stop severe content uses Low. Turning output controls down to annotate-only or Off requires approval for modified guardrails.
Why isn't my Foundry guardrail applying to my agent?
There are three common causes. If the agent has its own guardrail, that guardrail fully overrides the model deployment's, so changes to the deployment's guardrail have no effect. Some risks, Spotlighting and Groundedness, aren't supported for agents and are skipped. And tool call and tool response controls only take effect on tools that support moderation, such as OpenAPI or Azure AI Search, not on MCP tools.
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.