Week 3: Microsoft Stack Deep Dive
Objective: Master RAI architecture in the Azure AI / Copilot / MCP ecosystem and understand how governance integrates structurally at design time.
Time Estimate: 8β10 hours
Deliverable: RAI Architecture Decision Record (ADR) Template β standardized format for documenting RAI decisions at design time
Azure AI Content Safety β Structural Integration Patternsβ
Azure AI Content Safety is a content policy enforcement layer that must be placed at the right architectural points:
PATTERN 1: Input Gate (always recommended)
User Input β [Content Safety: Prompt Shield] β LLM
β Block | Flag | Pass-through
PATTERN 2: Output Gate (always recommended for customer-facing)
LLM Output β [Content Safety: Text Moderation] β User
β Block | Rewrite | Pass-through
PATTERN 3: Retrieved Content Gate (critical for RAG)
Retrieved Chunk β [Content Safety scan] β Prompt Context
β Block poisoned content before LLM sees it
PATTERN 4: Grounding Verification (for factual systems)
LLM Response β [Groundedness Detection] β Output
β Flag ungrounded claims for human review
Architecture decision: Every content safety call adds latency and cost. Define at design time which gates are mandatory (input + output) vs. configurable.
Azure AI Foundry β Evaluations as CI/CD Gatesβ
Build evaluations into the deployment pipeline β not run manually:
| Evaluation Type | What It Measures | Threshold Recommendation |
|---|---|---|
| Groundedness | Are claims supported by retrieved context? | β₯ 0.85 |
| Relevance | Is the response relevant to the query? | β₯ 0.80 |
| Safety | Does the response contain harmful content? | β₯ 0.95 (block deployment if below) |
| Fairness | Does quality differ across user groups? | Run on major model updates |
# AI Evaluation in CI/CD pipeline
- name: Run RAI Evaluations
with:
dataset: ./eval/golden_dataset.jsonl
evaluators: groundedness,safety,relevance
threshold_safety: 0.95
fail_on_threshold_breach: true # Block deployment if safety < 0.95
MCP Server Governance β When RAI Release Assessment Appliesβ
The 5-Tier Compliance Gateβ
| Gate | Applies When | Reviews Required |
|---|---|---|
| 1: Security Only | Read-only tools, no AI, non-sensitive data, internal | Security |
| 2: + Privacy | Tools access PII or personal data | Security + Privacy |
| 3: + Non-GenAI RA | ML/embeddings inside any tool handler | Security + Privacy + Non-GenAI RA |
| 4: + GenAI RA | LLM inside any handler, OR generates content, OR escalation-trigger tools | Security + Privacy + GenAI RA |
| 5: + Restricted Use | Code execution, healthcare/legal, customer-facing autonomous, cross-tenant | All above + Restricted Use |
An MCP server with no AI inside still requires a GenAI RA if it exposes escalation-trigger tools:
send_email()/send_teams_message()β mass communications at AI agent speedexecute_sql()with write access β bulk data modificationcreate_pull_request()/deploy_to_production()β code pipeline control
M365 Mail MCP, SQL MCP, and Azure DevOps MCP all fall here.
The question is not: does this server use AI?
The question is: can an AI agent use this server to cause harm at scale?
12 Risk Dimensions for MCP Scoringβ
| # | Dimension | High Risk Signal |
|---|---|---|
| 1 | AI/ML Usage | Any LLM/SLM/embeddings inside |
| 2 | Content Generation | Produces novel text, code, or summaries |
| 3 | Data Sensitivity | PII, health, financial, or confidential data |
| 4 | Action Consequence | Irreversible or high-impact actions |
| 5 | Reversibility | Actions that cannot be undone |
| 6 | User Scope | Affects many users simultaneously |
| 7 | Autonomy Level | Minimal human oversight in the flow |
| 8 | Trust Chain Position | Called by other AI agents (trust inheritance) |
| 9 | Third-Party AI | Calls external AI APIs |
| 10 | Sensitive Use Category | Healthcare, legal, financial, HR |
| 11 | Consent & Transparency | Users unaware AI is acting on their behalf |
| 12 | Deployment Environment | Customer-facing, cross-tenant |
Copilot Extensibility β Inherited vs. Owned RAIβ
| Copilot Component | RAI Inherited from Microsoft | RAI You Must Own |
|---|---|---|
| Microsoft Copilot base | Content filtering, grounding, safety eval | Your data scope, your tool permissions |
| Declarative Agent | Copilot's system-level safety | System prompt, data connector access |
| Custom Engine Agent (own LLM) | Nothing | Everything: safety, grounding, fairness, monitoring |
| MCP Server (tools) | Nothing | All 12 dimensions, all 5 compliance gates |
This Week's Resourcesβ
| Resource | Type | Estimated Time |
|---|---|---|
| Azure AI Content Safety docs | Technical | 1.5 hours |
| Azure AI Foundry evaluation concepts | Technical | 1 hour |
| Copilot extensibility overview | Reading | 1 hour |
| MCP Specification | Technical | 1.5 hours |
| Microsoft RAI Standard v2 | Reading | 1 hour |
Hands-On Exerciseβ
Design a Copilot-connected AI assistant with three MCP tools:
search_documents()β reads SharePoint documents (read-only, internal)send_email()β sends email via M365 Mail (write, external communication)run_report_query()β executes read-only SQL queries on a BI database
For each MCP server:
- Apply the 5-tier compliance gate β which gate does it reach?
- Score the 12 risk dimensions β how many are High?
- Identify which reviews are required
- Draw the trust boundary diagram showing which agents are authorized to call each server
Week 3 Deliverable: RAI Architecture Decision Record Templateβ
## ADR-[number]: [Decision Title]
**Date:** YYYY-MM-DD
**Status:** Proposed | Accepted | Superseded
**Context:** What situation prompted this decision? What RAI risk is being addressed?
**Decision:** What did we decide to do?
**RAI Principles Addressed:** Fairness | Reliability | Privacy | Inclusiveness | Transparency | Accountability
**Compliance Gate Impact:** Does this decision affect which compliance gate applies?
**Trade-offs:** What did we give up (performance, UX, cost)?
**Alternatives Considered:** What else did we evaluate?
**Consequences:** What becomes easier? What becomes harder?
**Review Trigger:** When should this decision be revisited?
Knowledge Checkβ
- Where in a RAG pipeline should Prompt Shield be placed β and why?
- An AI Foundry evaluation shows groundedness 0.91 and safety 0.88 (threshold: 0.95). What happens in CI/CD?
- A team says: "We don't use AI inside our MCP server, so we don't need a RAI RA." What do you ask them first?
- What is the difference between a Declarative Agent and a Custom Engine Agent in terms of RAI ownership?