ID Protection for agents (Risky Agents)
The risk signals for agents, Learning Mode, on-behalf-of risk attribution, and the risky-agent Graph APIs.
Why this matters
An agent that runs continuously with credentialed access to Graph, Azure resources, and MCP tools is a valuable target. Once an attacker gets a foothold — via a stolen FIC token, a leaked blueprint credential, or an over-permissive OBO chain — the blast radius is far worse than a compromised human user. Microsoft's answer is ID Protection for agents, which extends the existing risky-user machinery to agent identities with an agent-specific detection set and remediation model.
Cross-ref: Lesson 8.1 (Prompt injection + token theft) and Lesson 8.2 (MCP supply chain) tell you what attackers do; this lesson is Microsoft's detection surface for those attacks at the identity layer. Pair it with Conditional Access (Lesson 10.5) for automated response.
Learning objectives
- Know the eight agent risk signals ID Protection currently emits and what triggers each.
- Understand Learning Mode and why brand-new agents get a grace period.
- Understand the OBO risk attribution rule (why OBO risk lands on the user, not the agent).
- Query
riskyAgents/agentRiskDetectionsvia Microsoft Graph. - Wire ID Protection risk into Conditional Access for auto-response.
1. The eight agent risk detections
Currently all detections are offline (post-facto batch scoring, not real-time), but they feed Conditional Access which is near-real-time via CAE. Detections apply to autonomous agent activity; OBO risk attributes to the user (Section 3).
riskEventType | Trigger | Severity typical |
|---|---|---|
adminConfirmedAgentCompromised | An admin manually marks the agent as compromised in the portal | High (immediate) |
earlyLifeMaliciousActivity | Newly-created agent exhibits multiple suspicious patterns within its first few minutes / hours — the classic "attacker registered a new agent to bypass detection" pattern | High |
entraDirectoryReconnaissance | Agent runs queries that look like directory recon — enumerating users, groups, roles, service principals, permissions | Medium → High |
failedAccessAttempt | Agent tried and failed to access resources it isn't authorized for. Often means an attacker is replaying a stolen agent token against unauthorised resources | Medium → High |
threatIntelligenceAccount | Microsoft's threat intel matches the agent's activity to a known attacker pattern (IPs, TTPs, indicators) | High |
signInSpike | Agent's sign-in frequency spikes far above its baseline — automation kit or credential-stuffing indicator | Medium |
suspiciousCredentialUsage | New credential added to the blueprint and then actually used — flags the "attacker adds a secret and uses it" pattern | High |
unfamiliarResourceAccess | Agent targets resources it doesn't usually access — attempted lateral movement or scope creep | Medium |
Two things to notice:
- These map very directly to the attack patterns in Lesson 8 (token theft, confused deputy, lateral movement, prompt-injected exfil). ID Protection is Microsoft's implementation of ITDR for agents.
- Several signals require baseline learning. A brand-new agent has no baseline → hence Learning Mode.
2. Learning Mode — the newborn grace period
Agents with no history would otherwise trigger dozens of false positives on day 1 (every access is "unfamiliar", every sign-in a "spike"). ID Protection has Learning Mode:
- Newly created (or long-dormant) agents have their behavioural detections (spikes, unfamiliar resource access, etc.) auto-suppressed.
- Meanwhile the early-life malicious activity detector runs in parallel — so genuine "attacker registered this agent" behaviour is still caught.
- After enough legitimate activity, Learning Mode ends and behavioural detections start firing normally.
Implication: don't panic if a fresh agent's risk stays at None for the first day even though you know it's active. That's Learning Mode. Do panic if earlyLifeMaliciousActivity fires — that means the newborn is doing attacker-like things and Learning Mode is not going to save it.
3. OBO risk attribution rule (memorise this)
In OBO flows, risky behaviour is attributed to the user, not the agent.
Rationale: the agent is a shared piece of software running for many users; disabling the agent globally because Alice's session leaked would break Bob, Charlie, and Diana. Instead, the risk lands on Alice's session and any user-scoped ID Protection policies (block risky users, require password change, revoke sessions) apply.
Consequences:
- Do not write a CA policy that fires on "agent risk = high" and expect it to catch OBO abuse.
- Do write a user CA policy on the app used to invoke OBO agents — the risk will attribute there.
- Your autonomous flows will fire agent risk normally.
Only the autonomous and agent-user account flows attribute risk to the agent object.
4. Where risky agents surface
4.1 ID Protection dashboard (Entra portal)
A tile summarises risky agents by risk level. Click through to the Risky Agents report — the equivalent of Risky Users but for agent identities. From there you can:
- Filter / sort by agent, risk state, risk level.
- Drill into a specific agent's risk detections (last 90 days of retention).
- Take action inline.
4.2 Actions available on a risky agent
| Action | Meaning | Downstream effect |
|---|---|---|
| Confirm compromise | You investigated; it is compromised | Sets risk = High. Triggers CA policies configured to block High-risk agents. Creates an adminConfirmedAgentCompromised detection. |
| Confirm safe | False positive after investigation | Clears risk to None. Trains the system to trust similar activity. |
| Dismiss risk | No longer relevant | Clears the specific detection but the system keeps flagging similar future activity. |
| Disable | Prevent all sign-ins across Entra + connected apps | Hard-off switch. Use for active-incident response. |
4.3 Microsoft Graph APIs
Two collections in the ID Protection Graph surface:
GET /identityProtection/riskyAgents— current risky-agent list withid,displayName,riskLevel,riskState,riskDetail,sponsors.GET /identityProtection/agentRiskDetections— the raw detection events (up to 90 days).
You can filter, page, and export. Feed both into your SIEM.
Example — top current risky agents by risk level:
GET https://graph.microsoft.com/beta/identityProtection/riskyAgents
?$filter=riskLevel eq 'high'
&$select=id,displayName,riskLastUpdatedDateTime,sponsorsExample — all detections in the last 7 days for a specific agent:
GET https://graph.microsoft.com/beta/identityProtection/agentRiskDetections
?$filter=agentId eq '9d6f8e73-...-agent-identity'
and detectedDateTime ge 2026-06-01T00:00:00ZRule: write both to Splunk / Sentinel via diagnostic settings → Log Analytics → your SIEM. That way agent risk is queryable alongside user risk, sign-in logs, and Defender alerts.
5. Automated response — CA template
The recommended pattern is CA policy that blocks agents with High risk. Microsoft ships a CA template exactly for this:
Policy: Block high-risk agents
Assignments:
Include: All agent identities
Conditions:
Agent risk level: High
Access controls:
Grant: Block access
(No exceptions)
State: OnCombined with CAE-supported resources, this means:
- Admin clicks Confirm compromise in the portal (or your SIEM rule POSTs
confirmCompromisedvia Graph). - Risk elevates to High immediately.
- CA blocks the next token request.
- CAE-supported resources (Graph, Exchange, SharePoint, Teams) revoke active tokens within ~5 minutes.
- Agent is effectively offline until you remediate + confirm safe.
No human in the loop between detection and response for the "confirmed compromised" case. That's what you want.
6. Response playbook — from detection to closed ticket
You need a runbook. Suggested playbook (adapt to your SIEM + IR process):
- Detection fires —
agentRiskDetectionsreceives a new event (e.g.suspiciousCredentialUsage). - SIEM alert — Splunk / Sentinel rule creates a P2 ticket. Include agent oid, blueprint, sponsor, recent audit events.
- On-call review — check the recent audit log for the agent, check who added the new credential (was it a legitimate CI/CD run or a stranger?), check
sponsorand page them. - If real: Confirm compromise in ID Protection → CA blocks it → CAE revokes active tokens → escalate to incident response.
- If false positive: Confirm safe → dismiss detection with rationale → document in the ticket for future tuning.
- Root cause + remediation: rotate blueprint credentials (best case: rotate FIC managed identity), audit all sibling agents from the same blueprint, review the sponsor + owner assignments.
- Post-mortem: did the attacker exploit an inheritable permission? A dev secret? A misconfigured CA policy exclusion? Update controls.
Keep the runbook alongside your Module 8 attack response playbooks.
7. Integration with your existing SIEM / SOAR
- Splunk / Sentinel input: Diagnostic settings on the Entra tenant → forward
RiskyAgentsandAgentRiskDetectioncategories to a Log Analytics workspace / event hub / SIEM. - SOAR automation: on High detection, automatically call Microsoft Graph
POST /identityProtection/riskyAgents/confirmCompromised(requires the Conditional Access Administrator role) if agent matches a "kill switch" tag. - Reports: weekly report of
agentRiskDetectionsgrouped by detection type; long-term trend of "detection → CA block → confirmed compromise" ratio to measure detection quality.
8. Common pitfalls
- Ignoring Learning Mode. You panic that a busy agent shows no risk on day 1. Wait a week.
- Trying to catch OBO abuse via agent risk. Doesn't fire; risk attributes to the user. Target the user.
- Not enabling CAE on the resources you care about. Detection to block gap is minutes vs seconds.
- No CA policy to auto-block on Confirm Compromise. You mark it compromised and it keeps issuing tokens. Deploy the template.
- Sponsor not on-call. ID Protection alerts land in the SIEM; the sponsor named on the agent identity is the fastest-context human to investigate. Keep sponsors current (Lesson 10.7).
- Deleting a risky agent instead of investigating. You lose the audit trail. Disable + investigate first.
- Not exporting risk data. 90 days retention only; if you need longer for compliance, forward to a Log Analytics workspace / storage account / event hub.
- Not populating custom security attributes. Without
AgentEnvironment=prodyou can't write "block risky prod agents" as a precise policy; you either over-block (all agents) or don't block at all.
9. Hands-on lab (2 h)
Prereqs: an Entra tenant with P2 licence trial + Agent 365, plus the agent identities from Lessons 10.2-10.5.
- In the Entra portal, open ID Protection → Risky Agents. Confirm you see your test agents (probably with Risk = None initially due to Learning Mode).
- Simulate
earlyLifeMaliciousActivity: create a brand-new agent identity, immediately have it try to access three resources it has no permission for. Wait for the batch detection (up to 24 hours in the trial). Verify it appears in the Risky Agents report withearlyLifeMaliciousActivity. - Set the CA template "Block high-risk agents" to On.
- Manually Confirm compromise on a test agent. Immediately try to acquire a token — expect a CA block error.
- Query Graph:httpVerify the agent appears with the expected
GET /beta/identityProtection/riskyAgents?$filter=riskLevel eq 'high'riskDetail. - Simulate
suspiciousCredentialUsage: add a new secret to your test blueprint, then acquire a token with it (dev only). Wait 24 h. Verify the detection appears. - Configure diagnostic settings → forward
RiskyAgentscategory to a Log Analytics workspace. Write a KQL query for "all High detections in the last 7 days, by blueprint". - Confirm safe on the test agent; verify subsequent token acquisitions succeed.
10. Self-check
- Which of the eight detections indicates "attacker added a new credential and used it"?
- Why do OBO flows attribute risk to the user rather than the agent?
- What does Learning Mode suppress and what does it still let fire?
- Which admin action immediately elevates risk to High and triggers CA?
- What are the two Microsoft Graph collections for querying risky agents?
- What's the max retention for
agentRiskDetectionsif not exported?
11. References
- ID Protection for agents
- Investigate risk with Entra ID Protection
- Vendor-neutral Lesson 8.1 — Prompt injection + token theft (the attacks these detections catch).
- Vendor-neutral Lesson 8.2 — MCP supply chain.
- Vendor-neutral Lesson 7.1 — Audit + provenance (feed detections into your audit + SIEM).
Sign in to save your progress and earn badges.