SC-500 Security for AI: Copilot Oversharing, Purview DSPM, Entra Agent ID, Foundry Guardrails and Defender for AI
Security for AI is the set of controls that stop Microsoft 365 Copilot, Copilot Studio agents and Microsoft Foundry apps from exposing data or being abused: finding and fixing overshared SharePoint content, monitoring AI data risk with Microsoft Purview DSPM, protecting agents at runtime, governing agent identities with Microsoft Entra Agent ID, and filtering, metering and monitoring model traffic with Foundry guardrails, AI Gateway in API Management and Defender for Cloud. Most of these tools look alike on paper, so this lesson is organized around the decisions between them: which report shows old versus recent oversharing, which control hides content versus denies access, which identity a Conditional Access policy must target, which status code a token limit returns, and which guardrail an agent actually uses. Several of these products are new or in preview, so the lesson sticks to documented behaviour rather than portal click paths.
On this page10 sections
- Identifying and fixing SharePoint oversharing before Copilot
- Microsoft Purview DSPM: data risk assessments and AI activity visibility
- Real-time protection for Copilot Studio agents
- Conditional Access for Microsoft Entra Agent ID
- Managing Agent ID access: owners, sponsors, managers and access packages
- Analyzing an agent's blast radius in Microsoft Defender XDR
- AI Gateway in Azure API Management for Microsoft Foundry
- Defender for AI Services and the Data and AI security dashboard
- Guardrails for agents in Microsoft Foundry
- Managing agents in the Microsoft 365 admin center
- Find overexposed SharePoint content with data access governance reports and choose between Restricted Content Discovery, restricted access control and site access reviews
- Use Purview DSPM data risk assessments and their remediations, and get Copilot and third-party AI activity into DSPM
- Configure real-time protection for Copilot Studio agents with external threat detection and Defender rules
- Target Conditional Access at the right agent token subject, scale it with custom security attributes, and block risky agents
- Govern agent identities with owners, sponsors and access packages, and assess an agent's blast radius in Defender XDR
- Deploy AI Gateway in API Management for Foundry with per-project limits, content safety policies and managed identity
- Enable Defender for AI Services, configure Foundry agent guardrails, read the Data and AI security dashboard, and manage agents in the Microsoft 365 admin center
Microsoft Purview DSPM: data risk assessments and AI activity visibility
Data risk assessments in Microsoft Purview Data Security Posture Management (DSPM) find SharePoint content that Copilot and agents could overshare, and their Protect tab turns each finding into a remediation. DSPM is the Purview solution for seeing and reducing data risk from Microsoft 365 Copilot, agents and other AI apps.
Default vs custom assessments
| Assessment | Scope and schedule |
|---|---|
| Default | Created automatically. Runs every week against the top 100 SharePoint sites by usage (not by sensitive-item count). First results take a few days. |
| Custom | You create it to target other sites or users. Choose an item-level scan to list individual potentially overshared items (those with anonymous or external sharing links) with their labels and owners. Item-level scanning is SharePoint only, covers up to 10 sites, and needs a one-time authentication with a registered Microsoft Entra app holding the required Graph permissions. |
From item-level results you can resolve an item, apply a label, notify the site owner or remove the sharing link, all from Purview rather than the SharePoint admin center.
Protect-tab remediations
| Option | What it creates | Scope |
|---|---|---|
| Restrict access by label | A DLP policy for the Microsoft 365 Copilot location that stops Copilot and agents from summarizing items with the chosen sensitivity label. | Only labelled items; the rest of the site stays usable. |
| Restrict all items | Restricted Content Discovery on the site. | The whole site disappears from Copilot. |
| Auto-labeling | An auto-labeling policy that labels unlabelled files containing a sensitive information type (for example credit card numbers). | Matching unlabelled files. |
| Retention | A retention policy to delete stale content (for example not accessed for years). | Old content; it doesn't label or block Copilot. |
Pick by scope: when only some files must be kept from Copilot, label-scoped DLP beats a site-wide restriction; when files aren't labelled yet, auto-labeling comes first.
Seeing AI interactions: auditing, onboarded devices and the browser extension
DSPM sees different AI apps through different routes: Microsoft 365 Copilot and agent interactions arrive through the Purview audit log, while sensitive data pasted into third-party generative AI websites is only visible from devices onboarded to Purview, plus the Microsoft Purview browser extension for Chrome.
| AI app | What DSPM needs to see it |
|---|---|
| Microsoft 365 Copilot and Copilot agents | Microsoft Purview auditing turned on. With auditing off, every AI activity view stays empty. |
| Third-party AI sites (for example consumer chatbots in a browser) | Devices onboarded to Microsoft Purview (endpoint DLP). On Windows with Chrome, also deploy the Microsoft Purview browser extension to detect visits to AI sites and enforce endpoint DLP. |
| Apps built on Microsoft Foundry / Azure OpenAI | The data security for AI interactions setting of Defender for AI Services, which shares those prompts with Purview. |
Each route is independent, so a partial view tells you which route is missing: Copilot data proves the audit route works and says nothing about the endpoint route, while a completely empty view points to the audit log, which every Copilot view depends on. Data risk assessments are a different tool altogether: they evaluate oversharing in stored content rather than recording interactions. Interactions appear in activity explorer, where you can see sensitive information types detected in prompts and responses.
Real-time protection for Copilot Studio agents
Copilot Studio agents get real-time protection by connecting an environment to an external threat detection provider such as Microsoft Defender, which evaluates each tool invocation before it runs and can block it. Two layers are involved: the Copilot Studio side (Power Platform admin center) and the Defender side (rules and alerting).
Copilot Studio side: external threat detection
- Per environment. It is set up for each Power Platform environment under Security > Threat detection > Additional threat detection. There is no tenant-wide or inherited setting, so an environment created later is unprotected until you set it up too.
- Entra app with a federated credential. The connection uses a Microsoft Entra app registration with a federated credential. Registering an app alone does nothing until the environment is configured.
- Error behavior. If the provider doesn't answer within about one second, or errors, the default Allow the agent to respond lets the tool run (fail open). Choose Block the query to fail closed.
- Generative orchestration only. The provider is called when the generative orchestrator plans a tool call. Classic agents built on authored topics and trigger phrases skip it entirely, so switch them to generative orchestration to protect them.
Defender side: rules and alerts
| Rule | Behaviour |
|---|---|
| Default rule (built in) | Audits: records risky behaviour for all agents without stopping work. Keep it on for visibility. |
| Custom rules | Block chosen detection types (for example secret exfiltration) for the agents in the rule's scope, before the action runs. |
Keep the Default rule and add scoped custom block rules: switching the Default rule off removes visibility for every agent not covered by a custom rule. Alerts and incidents in the Defender portal need the Microsoft 365 connector (set up from the Security for AI Get started page). Without it, blocking still works, but the SOC sees no matching alerts.
| Control | Decides |
|---|---|
| Defender custom rule | Whether a specific risky action runs, at runtime |
| Block the query error behavior | What happens only when the provider times out or errors |
| Conditional Access | Whether a token is issued, before any action |
Conditional Access for Microsoft Entra Agent ID
Conditional Access for agents applies to the subject of the token being requested, so the policy must target the identity that actually asks for the token: the agent identity (or its blueprint) when the agent acts as itself, and the signed-in user when the agent acts on a user's behalf. Microsoft Entra Agent ID gives AI agents their own identities. An agent identity blueprint is the template that agent identities are created from; an agent user is a separate user-like account some agents use.
| Access pattern | Token subject | Target the policy at |
|---|---|---|
| Autonomous / app-only (for example a scheduled agent using client credentials, no user) | The agent identity | The agent identity, or its blueprint to cover every agent created from it, under Users, agents or workload identities > Agents |
| On-behalf-of (OBO): the agent acts for a signed-in user | The user (the token also identifies the calling agent) | The users or groups who use the agent. A policy on the agent identity or blueprint doesn't cover these requests. |
| Agent user account | The agent user | Agent users, under Agents |
Agent identities are selected through the Agents option, not the Workload identities option used for ordinary service principals.
Scaling with custom security attributes
Picking agents one by one means editing the policy for every change, and excluding a blueprint is too coarse when agents from the same blueprint are approved individually. Microsoft's recommended pattern is a policy that includes all agent identities, excludes by a custom security attribute (for example an approval-status attribute) and grants Block. Approving an agent then means tagging it; the policy never changes, and new untagged agents are blocked automatically.
Agent risk
Microsoft Entra ID Protection scores agent identities, and Conditional Access exposes that as the Agent risk condition. To stop high-risk agents: all agent identities, all resources, Agent risk High, grant Block. Sign-in risk is a user signal and service principal risk covers workload identities, so neither applies to agents. As with any new block policy, start in Report-only, review the impact in the sign-in logs, then switch it On.
Licensing
Conditional Access for agents has its own licence requirement: Microsoft 365 E7 (which includes Agent 365 and Microsoft Entra Suite), or a Microsoft Agent 365 licence paired with at least Microsoft Entra ID P1 or Microsoft 365 E3. Entra ID P1 alone covers Conditional Access for users, not for agents.
Managing Agent ID access: owners, sponsors, managers and access packages
Agent ID separates technical administration (owners) from business accountability (sponsors), and grants agents governed, time-bound access through entitlement management access packages.
| Relationship | Can do | Can't do |
|---|---|---|
| Owner | Technical administration: modify the agent identity, re-enable it, restore a soft-deleted identity, hard-delete. Owners can be users (including guests) or service principals; groups can't be owners. | — |
| Sponsor | Business accountability: disable the agent identity, change its sponsors, soft-delete it, request and extend access packages. | Re-enable or restore what they disabled or deleted; make themselves owners. |
| Manager | Request access packages for agents. | Modify, re-enable or delete agents. |
The split is deliberate: a sponsor can always take an agent out of service quickly, but bringing it back is a technical decision reserved for an owner or an administrator such as an Agent ID Administrator.
Groups as sponsors
Every agent identity and blueprint needs at least one sponsor. Using a group keeps sponsorship working through staff changes, and all members get sponsor rights. Allowed: dynamic membership groups (security or Microsoft 365) and assigned-membership Microsoft 365 groups. Not allowed: assigned-membership security groups and any role-assignable group.
Access packages for agents
Entitlement management access packages can give agent identities security group membership, API permissions and Microsoft Entra roles. Set the assignment policy's Who can get access to include agent identities, add approvers and an expiry (for example 90 days). The sponsor (or the agent itself) requests the package with a business justification, approvers decide, the sponsor is notified before expiry and can request an extension, which goes through approval again.
| Way to give an agent access | Approval | Expiry and review |
|---|---|---|
| Access package | Yes, by the policy's approvers | Yes; extensions are re-approved |
| Direct group membership | No | No; lasts until someone removes it |
| Admin consent to an application permission | No (a one-off admin decision) | No |
Conditional Access sits on top of whichever grant is used: it can add conditions or block a token, but it never grants access itself.
Analyzing an agent's blast radius in Microsoft Defender XDR
An agent's blast radius is everything its identity could reach if compromised (permissions, knowledge sources and actions), and you assess it in the Microsoft Defender portal from the AI agents inventory, attack paths and advanced hunting.
- AI agents inventory (Assets > AI agents) lists discovered agents. For Microsoft Foundry agents (and AWS Bedrock or Google Vertex AI agents) the detail pane shows posture insights, permissions, knowledge sources, capabilities and risk factors, and links to attack paths on the map showing how a compromise could spread to sensitive resources.
- Copilot Studio agents are discovery only in the inventory: their detail pane doesn't show posture. Assess their permission breadth, knowledge source configuration and risky settings with the prebuilt AI Agents queries in Advanced hunting.
| View | Question it answers |
|---|---|
| Defender portal AI agents inventory + attack paths | What could a compromised agent reach? |
| Advanced hunting AI Agents queries | How broad are a Copilot Studio agent's permissions and knowledge sources? |
| Microsoft 365 admin center agent registry | Which agents exist, who can use them, and their lifecycle |
| Purview activity explorer | What did users and agents actually do with data? |
| Defender for Cloud dashboard | How protected are the Azure data and AI resources? |
AI Gateway in Azure API Management for Microsoft Foundry
AI Gateway puts Azure API Management in front of a Microsoft Foundry resource so you can enforce per-project token limits, content safety and keyless authentication on model traffic. In Foundry you enable it for a Foundry resource under Manage > AI Gateway, add projects to it, and set limits per project from the Foundry portal without writing policy XML.
Which API Management instance
- Use existing APIM lists only instances in a v2 tier, in the same tenant and subscription, where you hold API Management Service Contributor or Owner. Classic tiers (including classic Premium) never appear, whatever your permissions.
- Create new provisions a Basic v2 instance.
- If the Foundry resource has public network access disabled, the gateway must be privately reachable: Standard v2 or Premium v2 with a private endpoint, or Premium v2 injected into a virtual network. Standard v2 virtual network integration is outbound only, so the gateway's inbound endpoint stays public.
Token limits and their status codes
| Limit | When exceeded |
|---|---|
| Tokens-per-minute (TPM) rate limit, per project | 429 Too Many Requests, clears within the minute |
| Total token quota over a period, per project | 403 Forbidden for every call until the period resets or the quota is raised |
The point of the gateway is per-project metering. A model deployment's own TPM quota is one pool for all callers of that deployment; AI Gateway divides consumption by project in front of it.
API Management policies for model traffic
llm-token-limitenforces token rate limits and quotas (what AI Gateway configures for you).llm-content-safetysends content to an Azure AI Content Safety backend and returns 403 when it is flagged. In the inbound section it checks prompts before they reach the model; in the outbound section it checks completions.shield-prompt="true"adds detection of user prompt attacks (jailbreaks). Per-category thresholds block content at or above the threshold severity: threshold 4 blocks severity 4 and higher, threshold 5 lets severity 4 through.- Managed identity to the backend: the
authentication-managed-identitypolicy gets a Microsoft Entra token with API Management's system- or user-assigned identity and attaches it to backend calls, so no Foundry API key is stored anywhere (not even in named values or Key Vault). The identity needs a suitable Azure role on the Foundry resource.validate-jwtis different: it checks tokens that callers present to the gateway.
Defender for AI Services and the Data and AI security dashboard
Defender for AI Services (threat protection for AI services) is the Defender for Cloud plan that scans prompts to Foundry and Azure OpenAI workloads and raises alerts such as jailbreak, credential theft and data leakage; the Data and AI security dashboard summarizes AI and data resources and that protection in one view.
Enabling and tuning the plan
Enable it per subscription: Defender for Cloud > Environment settings > the subscription > the AI services plan On. It works with Azure AI Content Safety Prompt Shields and Microsoft threat intelligence, and its alerts flow into Defender XDR. Plan settings and app changes enrich those alerts:
| Need | Setting |
|---|---|
| Alerts should include the suspicious parts of prompts and responses | Turn on user prompt evidence. While it's off, prompts are still analysed but alerts don't include the segments. |
| Alerts should name the end user and source IP when an app calls the model with its own identity | The app sends UserSecurityContext (at minimum EndUserId and SourceIP) in each request. Diagnostic logs only show the app's managed identity. |
| Prompts from Foundry apps should be visible in Microsoft Purview | Data security for AI interactions, which shares prompts with Purview for compliance; it doesn't enrich Defender alerts. |
| Layer | Output |
|---|---|
| Defender for AI Services | Runtime threat alerts for the SOC (jailbreak, data leakage, credential theft) |
| Defender CSPM | Posture: recommendations, attack paths, sensitive grounding data |
| Foundry guardrail | In-app filtering of content; blocks or annotates, but is not an alerting pipeline |
Data and AI security dashboard
The dashboard in Defender for Cloud gives a per-cloud view of data and AI resources, their protection coverage and top issues. Its AI closer look shows AI discovery, AI threat protection (prompts scanned and AI alerts by severity), AI queries in security explorer, and internet-exposed resources used for grounding; a data closer look does the same for data stores. It needs the Microsoft.Security resource provider registered on each subscription, and viewers need at least the Security explorer role (read access to assessments, subassessments and alerts). Each widget depends on a plan:
| Insight | Comes from |
|---|---|
| Security graph queries, AI posture, which grounding stores hold sensitive data | Defender CSPM with the sensitive data discovery extension |
| Prompts scanned and AI alerts | Threat protection for AI workloads (Defender for AI Services) |
| Storage and database threat data | Defender for Storage and Defender for Databases |
Because each tile maps to one plan, a dashboard where some tiles are populated and others are empty is diagnosed tile by tile: find the plan behind the empty tile and check whether it is enabled on that subscription. Microsoft 365 data posture lives in Purview DSPM, a separate product.
Guardrails for agents in Microsoft Foundry
A Foundry guardrail is a set of risk controls (such as hate, violence, user prompt attacks and indirect attacks) applied at chosen intervention points, and an agent uses the guardrail assigned to it, which fully replaces its model deployment's guardrail.
Intervention points
| Point | Scans |
|---|---|
| User input | The prompt the user sends |
| Tool call | What the agent sends to a tool |
| Tool response | What a tool returns, before it enters the agent's context |
| Output | The final answer to the user |
Match the risk to where it arrives. A user prompt attack (jailbreak) is typed by the user; an indirect attack (cross-domain prompt injection) hides instructions in data the agent reads, such as web pages from Bing grounding, so it is caught by an indirect attack control at tool response. Scanning output is too late: the agent has already acted on the injected content.
Which guardrail applies
- An agent with its own guardrail uses only that guardrail: no merge and no "strictest wins". The deployment's guardrail still governs direct calls to the model.
- An agent with no assigned guardrail inherits its model deployment's guardrail.
- Controls are evaluated independently at their own intervention points.
Coverage limits for agents
- Agents support only the annotate and block action.
- Some preview risks, such as Groundedness and Spotlighting, aren't supported for agents: they still work for model deployments using the same guardrail.
- Tool call and tool response controls need moderation support from the tool. Supported tools include Azure AI Search, Azure Functions, OpenAPI, SharePoint grounding, Fabric Data Agent, Bing grounding, Bing Custom Search and Browser Automation; other tools, such as a custom MCP server, aren't scanned at those points.
Guardrails handle content risk only; token limits belong to AI Gateway.
Managing agents in the Microsoft 365 admin center
The Microsoft 365 admin center's agent registry lets an AI Administrator control each agent's availability and lifecycle, and each action has a different reach: block, uninstall, delete, stop, and owner changes.
| Action | Effect |
|---|---|
| Block / unblock | Tenant-wide: no user can use the agent, including users who already installed it; the agent is untouched and unblocking restores it. For Copilot Studio and Agent Builder agents this covers Microsoft 365 Copilot and other hosts; for SharePoint and Foundry agents it only affects availability in Copilot Chat. |
| Install / uninstall | Deploys the agent to, or removes it from, the users chosen (Installed for). Uninstalling doesn't stop people self-installing while the agent is still Available to them. |
| Delete / restore | A 30-day soft delete; the agent becomes unavailable to its maker too. |
| Start / stop (Foundry agents only) | Deallocates or restarts the agent deployment's Azure compute, so every caller, including apps calling Foundry directly, is cut off. Requires the Azure AI Owner role on the Foundry resource (the details pane offers Add role). |
| Add an owner | Gives an Agent Builder agent another owner with equal rights. Owners must be individual users (no groups), and the last owner can't be removed. |
| Assign a new owner | Transfers ownership and removes all of the previous owner's access at once. |
Reading the table by reach: block is reversible and leaves the agent's configuration untouched, delete starts a removal clock, and stop is the only action that reaches the Azure compute behind a Foundry agent, which matters because block's Copilot Chat scope leaves direct callers unaffected. Ownership changes follow the same logic: adding owners is additive, while assigning a new owner is a transfer.
Tip. Expect short scenarios about a company's Copilot rollout, its agents or its Foundry apps, each with a specific requirement, followed by which report, control, policy target, plan or setting to use. Questions hinge on near-twin choices and stated constraints: snapshot versus activity reports, hiding content versus denying access, default versus custom data risk assessments, auditing versus device onboarding for DSPM, the agent identity versus the user as Conditional Access target, owners versus sponsors, 429 versus 403, inbound versus outbound content safety, the agent's guardrail versus the model's, and block versus stop for an agent. Some items are select-two, where each answer fixes a separate part of the requirement; read every constraint in the scenario, because it usually rules out all but one of several workable controls.
- Copilot only shows what users can already open, so oversharing is the AI risk: the site permissions snapshot report finds old exposure, while activity reports only look back 28 days.
- Restricted Content Discovery hides a site from Copilot and org-wide search without changing access; restricted access control denies entry outside chosen groups; a site access review hands the fix to site owners.
- The default DSPM data risk assessment covers the top 100 SharePoint sites by usage weekly; item-level fixes need a custom assessment with an item-level scan; label-scoped Copilot DLP keeps the rest of a site usable.
- Copilot activity reaches DSPM through auditing; third-party AI sites need onboarded devices plus the Purview browser extension for Chrome.
- Copilot Studio threat detection is set up per environment, fails open by default (choose Block the query), and covers generative-orchestration agents only; Defender's Default rule audits, custom rules block, and alerts need the Microsoft 365 connector.
- Conditional Access follows the token subject: agent identity or blueprint for app-only, the user for on-behalf-of; use custom security attributes to approve agents without editing policy, and the Agent risk condition in Report-only first.
- Sponsors can disable but not re-enable an agent; sponsor groups must be dynamic or assigned Microsoft 365 groups, never role-assignable; access packages give agents approved, expiring access.
- Foundry AI Gateway needs a v2-tier API Management instance in the same tenant and subscription; 429 means the per-minute limit, 403 means the token quota is used up.
- Defender for AI Services is enabled per subscription; prompt evidence adds prompt text to alerts and UserSecurityContext adds the end user and IP.
- An agent's own guardrail fully replaces its model's; agents can't use Groundedness yet, and tool-point controls only work for tools with moderation support.
Frequently asked questions
What is the difference between Restricted Content Discovery and restricted access control in SharePoint?
Restricted Content Discovery stops a site's content from appearing in Microsoft 365 Copilot and organization-wide search, but it doesn't change permissions, so anyone with access can still open files directly. Restricted access control limits a site to members of chosen Microsoft 365 or Microsoft Entra security groups, so everyone else is denied even if broader permissions remain. Use the first to quickly stop Copilot from surfacing content; use the second to actually block access.
Why doesn't my Conditional Access policy on an agent identity apply when the agent acts for a user?
When an agent uses the on-behalf-of flow, the signed-in user is the token's subject, so Conditional Access evaluates the policies assigned to that user, not policies that target the agent identity or its blueprint. Agent identity policies apply to app-only tokens the agent requests for itself. To control on-behalf-of access, assign the policy to the users or groups who use the agent.
Can a sponsor re-enable an agent identity in Microsoft Entra Agent ID?
No. A sponsor can disable an agent identity, change its sponsors or soft-delete it, but can't re-enable or restore it. An owner of the agent identity, or an administrator such as an Agent ID Administrator, has to re-enable it.
What does a 403 from Foundry AI Gateway mean compared with a 429?
AI Gateway enforces two per-project limits through Azure API Management. Exceeding the tokens-per-minute rate limit returns 429 Too Many Requests and clears within the minute. Using up the total token quota for the period returns 403 Forbidden on every call until the quota period resets or the quota is raised.
Which API Management tiers work with AI Gateway in Microsoft Foundry?
AI Gateway works only with API Management instances in a v2 tier that are in the same tenant and subscription as the Foundry resource; classic tiers aren't listed. Creating a new gateway from Foundry provisions Basic v2. If the Foundry resource has public network access disabled, use Standard v2 or Premium v2 with a private endpoint, or Premium v2 injected into a virtual network.
If an agent and its model deployment both have guardrails in Foundry, which one applies?
The guardrail assigned to the agent applies, and it fully replaces the model deployment's guardrail for that agent; the settings aren't merged and the stricter one doesn't win. The deployment's guardrail applies to the agent only when no guardrail is assigned to the agent, and it still governs direct calls to the model.
How do I get prompt text and end-user details into Defender for AI Services alerts?
Turn on user prompt evidence in the AI services plan settings so alerts include the suspicious segments of prompts and responses. For end-user details, the application must send UserSecurityContext fields, at least EndUserId and SourceIP, with each request, because an app calling Azure OpenAI with its own identity otherwise shows up only as the app.
What is the difference between blocking and stopping an agent in the Microsoft 365 admin center?
Blocking makes an agent unavailable to everyone in the tenant and can be undone without changing the agent; for Foundry and SharePoint agents it only affects availability in Copilot Chat. Stop exists only for Microsoft Foundry agents: it deallocates the agent's Azure compute so every caller is cut off, and it needs the Azure AI Owner role on the Foundry resource.
Source
This lesson covers the "Secure compute" domain of the official SC-500 exam guide. Vendors revise their guides — check the source for the current version.
- Microsoft SC-500 study guide — Microsoft Learn
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.