Skip to main content

Week 3: Microsoft Stack Deep Dive

Week Overview

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 TypeWhat It MeasuresThreshold Recommendation
GroundednessAre claims supported by retrieved context?β‰₯ 0.85
RelevanceIs the response relevant to the query?β‰₯ 0.80
SafetyDoes the response contain harmful content?β‰₯ 0.95 (block deployment if below)
FairnessDoes 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​

GateApplies WhenReviews Required
1: Security OnlyRead-only tools, no AI, non-sensitive data, internalSecurity
2: + PrivacyTools access PII or personal dataSecurity + Privacy
3: + Non-GenAI RAML/embeddings inside any tool handlerSecurity + Privacy + Non-GenAI RA
4: + GenAI RALLM inside any handler, OR generates content, OR escalation-trigger toolsSecurity + Privacy + GenAI RA
5: + Restricted UseCode execution, healthcare/legal, customer-facing autonomous, cross-tenantAll above + Restricted Use
The Row Teams Get Wrong Every Time

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 speed
  • execute_sql() with write access β€” bulk data modification
  • create_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​

#DimensionHigh Risk Signal
1AI/ML UsageAny LLM/SLM/embeddings inside
2Content GenerationProduces novel text, code, or summaries
3Data SensitivityPII, health, financial, or confidential data
4Action ConsequenceIrreversible or high-impact actions
5ReversibilityActions that cannot be undone
6User ScopeAffects many users simultaneously
7Autonomy LevelMinimal human oversight in the flow
8Trust Chain PositionCalled by other AI agents (trust inheritance)
9Third-Party AICalls external AI APIs
10Sensitive Use CategoryHealthcare, legal, financial, HR
11Consent & TransparencyUsers unaware AI is acting on their behalf
12Deployment EnvironmentCustomer-facing, cross-tenant

Copilot Extensibility β€” Inherited vs. Owned RAI​

Copilot ComponentRAI Inherited from MicrosoftRAI You Must Own
Microsoft Copilot baseContent filtering, grounding, safety evalYour data scope, your tool permissions
Declarative AgentCopilot's system-level safetySystem prompt, data connector access
Custom Engine Agent (own LLM)NothingEverything: safety, grounding, fairness, monitoring
MCP Server (tools)NothingAll 12 dimensions, all 5 compliance gates

This Week's Resources​

ResourceTypeEstimated Time
Azure AI Content Safety docsTechnical1.5 hours
Azure AI Foundry evaluation conceptsTechnical1 hour
Copilot extensibility overviewReading1 hour
MCP SpecificationTechnical1.5 hours
Microsoft RAI Standard v2Reading1 hour

Hands-On Exercise​

Exercise β€” Compliance Gate Analysis

Design a Copilot-connected AI assistant with three MCP tools:

  1. search_documents() β€” reads SharePoint documents (read-only, internal)
  2. send_email() β€” sends email via M365 Mail (write, external communication)
  3. 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​

  1. Where in a RAG pipeline should Prompt Shield be placed β€” and why?
  2. An AI Foundry evaluation shows groundedness 0.91 and safety 0.88 (threshold: 0.95). What happens in CI/CD?
  3. 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?
  4. What is the difference between a Declarative Agent and a Custom Engine Agent in terms of RAI ownership?