Generative AI does not create an entirely new set of security problems so much as it amplifies existing ones at machine speed. Permissions that were technically wrong but practically harmless become a search result. A user who would never have found a document now has it summarised for them. And an agent with a standing credential can be talked into using it by text hidden inside a file it was asked to read.
flowchart TB
subgraph IDP["Wrapped by identity — every agent gets a Microsoft Entra Agent ID, a sponsor and Conditional Access"]
subgraph STACK["The four places a control can go"]
direction TB
DATA["Data · Purview and SharePoint Advanced Management — data risk assessments<br/>sensitivity labels · DLP for Copilot · Restricted Content Discovery and Access Control"]
GATE["Gateway · AI Gateway in Azure API Management — token limits and quotas<br/>semantic caching · content safety policy · token telemetry"]
MODEL["Model and agent · Microsoft Foundry guardrails and controls — Prompt Shields<br/>groundedness · PII · protected material · blocklists · spotlighting"]
RUN["Runtime · Microsoft Defender Security for AI — real-time protection over<br/>tool invocations · Defender for AI Services detections"]
DATA --> GATE
GATE --> MODEL
MODEL --> RUN
end
endThe threats you are being asked to control
| Threat | What it looks like | Primary control |
|---|---|---|
| Oversharing | Copilot surfaces a salary file from a site shared with "Everyone except external users" | Purview DSPM data risk assessments; SharePoint Restricted Content Discovery and Restricted Access Control |
| User prompt injection (UPIA / jailbreak) | A user talks the model out of its system instructions | Foundry Prompt Shields — user prompt attack control |
| Cross-domain / indirect prompt injection (XPIA) | Hidden instructions inside a document, email or web page the agent reads | Prompt Shields — document attack control, plus spotlighting |
| Data exfiltration through the model | Sensitive content leaves in a prompt or a completion | Purview DLP for Copilot, Foundry PII control, sensitivity labels honoured at retrieval |
| Wallet abuse / denial of wallet | One team or one attacker consumes the whole token quota | AI Gateway token limits and quotas |
| Agent takeover and excessive agency | A subverted agent uses its own standing permissions to act | Entra Agent ID plus Conditional Access, least-privilege agent permissions, Defender real-time protection over tool invocations |
| Ungoverned "shadow" agents | Agents created by makers that nobody is tracking | Agent inventory in Defender and in the Microsoft 365 admin center; sponsors and owners in ID Governance |
1 · The data layer: stop the assistant seeing what it should not
This is the single highest-value piece of work before deploying Copilot, and it is entirely conventional data governance done properly.
Finding the oversharing
- Purview DSPM data risk assessments — an assessment runs automatically each week over the top 100 most-used SharePoint sites, and you can add custom assessments. It surfaces sites with sensitive data, risky sharing links and broad permissions, with remediation actions attached.
- SharePoint Advanced Management data access governance reports — sharing links, "Everyone except external users" (EEEU) usage, permission state for sites, OneDrive and files, and sensitivity labels applied to files.
- Content management assessment — finds sites with oversized audiences, EEEU, broken inheritance, inappropriate sharing, and sites that are inactive or ownerless.
- Site access review — delegates the review of those reports to the site owners who actually know whether the access is justified.
Containing it
| Control | Effect | Set at |
|---|---|---|
| Restricted Content Discovery (RCD) | The site's content stops appearing in organisation-wide search and in Copilot and agentic experiences. Permissions are unchanged, the content stays in the search index, and users can still reach content they own or have recently interacted with. | Per site, in the SharePoint admin center → Active sites → Settings, or Set-SPOSite -RestrictContentOrgWideSearch $true |
| Restricted Access Control (RAC) | Only members of a named Microsoft Entra security group or Microsoft 365 group can access the site at all — even if they previously had permissions or a sharing link. A genuine access boundary. | Per site, under SharePoint admin center → Policies → Access control |
| DLP for Microsoft 365 Copilot | Excludes labelled content from being used to ground a Copilot response. | Purview DLP policy, Copilot location |
| Sensitivity labels | Encryption and usage rights travel with the file; Copilot honours them and inherits the label into generated content. | Purview information protection |
RCD is discoverability, RAC is access
The distinction is exam-shaped. "Prevent this site's content from turning up in Copilot answers while the owners review permissions" is Restricted Content Discovery — it leaves access alone, which is why it can be applied quickly and reversed. "Ensure only the HR team can open this site, regardless of existing permissions" is Restricted Access Control. And note that RCD propagation is not instant — it depends on site size and index load.
Two things that have moved
Restricted SharePoint Search is retiring. It was the temporary allow-list of sites usable by Copilot; new enablement was blocked from 31 July 2026, and Microsoft directs you to Restricted Content Discovery instead. DSPM for AI is now "classic". Its capabilities have been folded into the unified Data Security Posture Management experience organised around data security objectives — one of which is "prevent data exposure in Microsoft 365 Copilot and Microsoft Copilot interactions". Exam items written against the older list will still say "DSPM for AI".
Monitoring what the AI is actually doing
In Purview, Activity explorer has an AI activities view showing AI interactions, the sensitive information types they contained, visits to generative AI websites, and DLP rule matches during those interactions. Workloads are grouped as Copilot experiences and agents, Enterprise AI apps (such as ChatGPT Enterprise) and Other AI apps. To see interactions with third-party AI sites at all, devices must be onboarded to Purview — which in practice means enrolled in Intune and onboarded to Defender for Endpoint.
2 · The model layer: Foundry guardrails and controls
In Microsoft Foundry, a guardrail is a named container of controls, and you assign it to model deployments and to agents.
| Control | Applies at | Notes |
|---|---|---|
| Hate, Violence, Sexual, Self-harm | User input and model output | Severity thresholds. These four can be overridden but never deleted from a guardrail. |
| Prompt Shields — user prompt attack | User input | Jailbreak attempts against the system instructions. |
| Prompt Shields — document attack | User input and tool responses | Indirect injection hidden in third-party content. The tool-response intervention point is what protects agents. |
| Protected material for text and for code | Output | Known copyrighted text and public-repository code. |
| Personally identifiable information | Input and output | Requires a recent API version. |
| Groundedness detection | Output | Flags claims unsupported by the provided source material. Streaming scenarios only. |
| Profanity and custom blocklists | Input and output | Your own terms and regular expressions. |
POST https://<resource>.services.ai.azure.com/openai/v1/responses
Authorization: Bearer <token>
Content-Type: application/json
# Select a named guardrail for this request. If the name does not match an
# existing guardrail, the call fails with InvalidContentFilterPolicy.
x-policy-id: contoso-public-facing
{
"model": "gpt-5",
"input": "Summarise the attached policy document.",
"instructions": "You are a helpful assistant. \"\"\" <documents> ...untrusted content... </documents> \"\"\""
}Four guardrail facts that get tested
One: Microsoft Default guardrails, such as Default.V2, cannot be edited — create a custom guardrail instead. Two: when both a model and an agent have a guardrail, the agent's guardrail wins. Three: a guardrail cannot be deleted while models or agents are still assigned to it. Four: selecting a guardrail per request is done with the x-policy-id header, and a name that does not exist returns InvalidContentFilterPolicy.
Spotlighting
Spotlighting is extra protection against document attacks: it tags untrusted input documents by base64-encoding them, so the model treats their content as lower-trust data rather than instructions. It is off by default, has no direct cost, and is available only for models used through the Chat Completions API — but the encoding increases the token count, which can push a long document over the input limit or raise cost. Delimit untrusted content with """ <documents> … </documents> """ and JSON-escape it so the safety system can parse it.
Foundry also offers a guided guardrail set-up for agents: a short questionnaire — who uses the agent, where its inputs come from, whether it touches sensitive data or PII, whether it calls external tools, whether it takes consequential actions, whether it generates code — that turns the answers into a recommended control set.
3 · The gateway layer: AI Gateway in API Management
Foundry has a built-in AI Gateway, backed by Azure API Management and configured from Foundry portal → Manage → AI Gateway. It governs ingress to a single Foundry resource; for anything broader you run API Management standalone.
| Capability | Policy | Behaviour |
|---|---|---|
| Token rate limiting | llm-token-limit | Tokens per minute per counter key. Exceeding it returns 429 Too Many Requests. |
| Total token quota | llm-token-limit | A budget per hour, day, week, month or year. Exceeding it returns 403 Forbidden. |
| Token telemetry | llm-emit-token-metric | Emits consumption as a custom metric with your own dimensions — the basis for chargeback. |
| Content safety | llm-content-safety | Screens prompts through Azure AI Content Safety at the gateway, independently of the model's own guardrail. |
| Semantic caching | llm-semantic-cache-store / -lookup | Reuses completions for semantically similar prompts. Needs an external RediSearch-compatible cache such as Azure Managed Redis. |
| Backend pools and circuit breaking | Backend configuration | Spread load across deployments, and fail over from provisioned throughput to pay-as-you-go. |
<inbound>
<!-- Cap each consumer's token consumption. Exceeding the per-minute rate
returns 429; exceeding the period quota returns 403. -->
<llm-token-limit counter-key="@(context.Subscription.Id)"
tokens-per-minute="5000"
estimate-prompt-tokens="true"
remaining-tokens-variable-name="remainingTokens" />
<!-- Emit token counts as a custom metric, dimensioned per consumer. -->
<llm-emit-token-metric namespace="genai">
<dimension name="Subscription ID" value="@(context.Subscription.Id)" />
</llm-emit-token-metric>
<!-- Screen prompts with Azure AI Content Safety before they reach the model. -->
<llm-content-safety backend-id="content-safety-backend" shield-prompt="true">
<categories output-type="EightSeverityLevels">
<category name="SelfHarm" threshold="4" />
<category name="Violence" threshold="4" />
</categories>
</llm-content-safety>
<!-- Reuse a semantically similar previous completion instead of calling the model. -->
<llm-semantic-cache-lookup score-threshold="0.05"
embeddings-backend-id="embeddings-backend"
embeddings-backend-auth="system-assigned" />
</inbound>Limits apply at the project level, so each project gets its own tokens-per-minute and quota. Creating the gateway needs Contributor or Owner to create the API Management instance (or API Management Service Contributor to reuse one), plus a Foundry owner-level role on the Foundry resource. The gateway also registers custom agents and MCP tools hosted anywhere into the Foundry inventory for governance.
Remember the two status codes
429 means the caller went too fast — it is a rate limit and it clears in a minute.403 means the caller has spent its budget for the period. A scenario describing an app that "worked all morning and then stopped entirely for the rest of the day" is the quota and a 403, not the TPM limit.
4 · The identity layer: Microsoft Entra Agent ID
Agent ID extends Microsoft Entra to AI agents, so an agent is a governed non-human identity rather than a shared app registration. Agent identity blueprints act as templates, creating individual agent identities in a parent–child relationship so policy applies consistently across large fleets. It supports OAuth 2.0, the Model Context Protocol (MCP) and agent-to-agent (A2A) protocols, and third-party agents from platforms such as AWS Bedrock can be brought in through the Entra ID Auth SDK sidecar or workload identity federation.
Agents created in Copilot Studio automatically receive an agent identity, with the maker recorded as the sponsor. Microsoft's own agents — the Conditional Access Optimization Agent, for example — carry one too, so their queries are attributed to an agent rather than to a person.
flowchart TB
Q["You want Conditional Access to govern what an agent can reach"] --> A{"Which OAuth flow is the agent using?"}
A -->|"On-behalf-of — a user signed in, and<br/>the agent acts as that user"| U["Target users and groups<br/>The user is the subject of the token exchange,<br/>so selecting agent identities would not match"]
A -->|"Client credentials — the agent acts<br/>as itself, with no user present"| AG["Target agent identities<br/>Scale with custom security attributes,<br/>and use agent risk as a condition"]| Capability | What it gives you |
|---|---|
| Conditional Access for agents | Adaptive policies over agent access, with agent risk as a real-time condition. Microsoft-managed policies provide a baseline that blocks high-risk agents. Scale targeting with custom security attributes rather than naming agents one by one. |
| ID Protection for agents | Risky-agent detections based on the agent's own behaviour and on the risk of the user it acts for. Learning mode suppresses behavioural alerts for agents with too little history, while a parallel detection still catches genuinely malicious early-life behaviour. Reports need Security Administrator, Security Operator or Security Reader; configuring agent-risk policies needs Conditional Access Administrator. |
| ID Governance for agents | Access packages, sponsors and owners, and time-bound access — so agents are onboarded and retired like employees and no agent is left orphaned. |
| Network controls | Global Secure Access applies web content filtering, threat intelligence filtering and file filtering to agent traffic, including for Copilot Studio agents. |
| Sign-in and audit logs | Agent authentication and activity are logged in Microsoft Entra and viewable in the admin center's Agent identities view. |
Preview status and licensing
Microsoft Entra Agent ID is in preview. The Agent ID platform itself is available to all Entra customers, but extending Entra security features to agents requires Microsoft Agent 365 — included with Microsoft 365 E7 and available as an add-on to E5, A5 or Business Premium. Treat any exam answer that assumes agent Conditional Access "just works" with an E3 licence with suspicion.
5 · The runtime layer: Defender real-time protection
Guardrails screen text. Real-time protection screens actions — it inspects agent activity throughout the agentic loop and can stop a risky tool invocation before it executes.
flowchart TB
U["A user or another agent sends a prompt"] --> GW{"AI Gateway in API Management<br/>token limits"}
GW -->|"Over the tokens-<br/>per-minute limit"| R429["429 Too Many Requests"]
GW -->|"Over the total token<br/>quota for the period"| R403["403 Forbidden"]
GW -->|"Within both"| IN{"Foundry guardrail, input controls<br/>hate · violence · sexual · self-harm<br/>user prompt attack · document attack · PII"}
IN -->|"A control fires"| BLK["Filtered — the annotation records<br/>detected and filtered"]
IN -->|"Clean"| M["The model responds, then the output controls run —<br/>the same categories plus protected material,<br/>groundedness and custom blocklists"]
M --> DEF{"The agent invokes a tool, and Defender<br/>real-time protection evaluates the<br/>invocation before it runs"}
DEF -->|"A custom rule matches"| STOP["Blocked, and recorded<br/>as a behaviour"]
DEF -->|"Allowed"| DONE["The tool runs; the default rule<br/>still records the behaviour"]| Agent type | What is evaluated |
|---|---|
| Copilot Studio agents | Tool invocations. Only agents using generative orchestration are covered — classic agents are skipped. |
| Foundry agents | User requests, agent responses, tool invocations and tool responses — the broadest coverage. |
| Agent 365 agents | Tool invocations evaluated through Work IQ MCP, including customer MCP tools onboarded to Agent 365. |
| Local agents on endpoints | Covered separately by AI agent runtime protection in Microsoft Defender for Endpoint, which must be in active mode. |
Default rule versus custom rules
- The default rule audits every agent: matching activity is recorded as a behaviour, and nothing is stopped. This is how you gain visibility before enforcing.
- Custom rules block matching actions before they execute, and also record the behaviour. Scope them narrowly to high-confidence threats and specific agents.
- Behaviours land in the
BehaviorInfotable in advanced hunting — what happened, why it was risky, and which agent, user and tool were involved — so they can drive custom detections and downstream automation. - Near-real-time detections surface as alerts only in audit mode; once a blocking rule covers an agent, alerts are not generated for it.
Turning it on for Copilot Studio
- In the Microsoft Defender portal, open Security for AI → Get started and select the Copilot Studio step.
- Toggle Real-time protection on.
- Copy the Power Platform integration URL and send it to your Power Platform administrator, who completes onboarding on their side using a Microsoft Entra application.
- Take the App ID back from them, paste it into the Defender portal and save. The Copilot Studio step then shows Connected.
- Connect the Microsoft 365 connector as well — without it, blocking still works but no alerts or incidents appear in the Defender portal.
Makers see the result in Copilot Studio as a Protection status column on the Agents page, reading Protected, Needs review or Unknown, broken down into threat detection, authentication, policy and content moderation.
Where agent security has landed
From 1 July 2026, agent security capabilities for Copilot Studio and Foundry agents require a Microsoft Agent 365 licence rather than being carried by Defender for Cloud Apps and Defender for Cloud. Three consequences worth knowing: the agent inventory table moved from AIAgentsInfo to AgentsInfo; real-time protection rules are defined under Settings → Security for AI → Policies & rules → Real-time protection; and Defender CSPM still discovers Foundry accounts and projects, but agent-level discovery, posture and threat detection now need the Agent 365 licence. The Defender for AI Services plan continues to protect Foundry models, including Azure OpenAI.
6 · Posture and monitoring for AI
| Surface | Where | Answers |
|---|---|---|
| AI security posture management | Included in Defender CSPM | Discovers generative AI workloads agentlessly across Azure OpenAI, Azure Machine Learning and Amazon Bedrock; surfaces the models, SDKs and configurations in use; and runs attack path analysis over them — for example grounding data exposed to the internet and open to poisoning. |
| Defender for AI Services | A workload protection plan in Defender for Cloud | Runtime detection for generative AI workloads — jailbreak attempts detected by Prompt Shields, data exposure, wallet abuse and suspicious access patterns — enriched with Microsoft threat intelligence. |
| Data and AI security dashboard | Defender for Cloud | One view of data and AI resources, their protection coverage, top issues, sensitive data findings, internet-exposed grounding resources and prompt-scanning volumes. |
| Security Dashboard for AI | ai.security.microsoft.com | The leadership view across Entra, Defender, Purview and Security Copilot: which AI assets exist, their posture, and where to act — including third-party models, apps, agents and MCP servers. |
| Agent inventory | Defender portal, and the Microsoft 365 admin center | Which agents exist, who sponsors them, what they connect to, and whether they are protected. Advanced hunting exposes the same data in AgentsInfo. |
What the Data and AI security dashboard needs
It is enabled at subscription level and only fills up if the feeding plans are on: Defender CSPM with the sensitive data discovery extension, Defender for Storage, Defender for Databases and threat protection for AI workloads. The minimum privileged role to view it is Security explorer. A question describing an empty dashboard is asking you to spot a missing plan, not a missing permission.
Blast radius
"Analyse blast radius for security risks related to Entra Agent ID by using Defender XDR" is the objective's phrase for a simple question: if this agent is subverted, what can it reach? You answer it by joining the agent's identity and its granted permissions to the exposure graph — the agent inventory in the Defender portal for the identity and its connections, and Microsoft Security Exposure Management's attack paths and critical asset classification for what lies downstream. The remediation is almost always the same two moves: narrow the agent's permissions, and put Conditional Access in front of them.
7 · Managing agents in the Microsoft 365 admin center
The administrative counterpart to all of the above. In the Microsoft 365 admin center you manage the agent inventory across Microsoft 365 — who owns each agent, who it is available to, its lifecycle, and which agents makers are permitted to create and publish at all. Power Platform administrators set the corresponding policies for Copilot Studio, including data loss prevention policies over connectors, which is why the Copilot Studio protection status surfaces Policies as its own category.
Scenario-to-answer lookup
| The scenario says… | The answer is… |
|---|---|
| "Copilot returns content from a site that is under permissions review" | Restricted Content Discovery on that site |
| "Only the HR security group may access the site, regardless of existing links" | Restricted Access Control |
| "Identify which sites are overshared before we roll out Copilot" | Purview DSPM data risk assessments, plus SharePoint Advanced Management data access governance reports |
| "Block a document containing hidden instructions from steering the agent" | Prompt Shields document attack control, at the tool response intervention point; add spotlighting |
| "One team must not be able to exhaust the model's capacity" | AI Gateway token limit per project or subscription key |
| "The app stopped working entirely for the rest of the day" | The total token quota — a 403, not a 429 |
| "Require phishing-resistant MFA when an agent acts for a user" | A Conditional Access policy targeting users and groups, because the flow is on-behalf-of |
| "Block an autonomous agent when its risk is high" | A Conditional Access policy targeting agent identities, with agent risk as the condition |
| "Stop the agent from running a dangerous tool, not just from saying something" | A custom real-time protection rule in Defender Security for AI |
| "See which agents exist and who is responsible for them" | Agent inventory in the Defender portal and the Microsoft 365 admin center; sponsors in Entra ID Governance |
| "Detect jailbreak attempts against our Azure OpenAI deployment" | Defender for AI Services, in Defender for Cloud's workload protection |
| "Show the CISO our overall AI risk in one place" | Security Dashboard for AI |
Check the preview line before you memorise
Much of this surface is in preview and changing quarterly: Entra Agent ID, Conditional Access for agents, real-time protection for Copilot Studio and Foundry agents, AI Gateway in Foundry, and spotlighting. The exam states that it may include commonly used preview features, so you cannot skip them — but do re-read the Microsoft Learn page for each one shortly before you sit, because the portal paths in particular have already moved once.
Next: Exam tips & caveats, for the final week.