Block high-risk agent identities with Conditional Access¶
Licence and role
Microsoft Agent 365 + Entra ID P2 or Microsoft 365 E5 (risk-based), or Microsoft 365 E7. Agent risk is in preview.
Why it matters¶
Autonomous agents sign in with their own agent identity, not a user, so your user Conditional Access policies don't cover them. Microsoft provides a policy that blocks agent identities that Entra ID Protection flags as high risk.
Steps¶
- Microsoft Entra admin center > Entra ID > Conditional Access > Policies > New policy.
- Users, agents or workload identities > What does this policy apply to? > Agents > Include: All agent identities.
- Target resources > Include: All resources.
- Conditions > Agent risk (Preview) > Configure: Yes > High.
- Grant > Block. Enable policy: Report-only. Review the impact, then switch to On.
- Agents that act through a user account or an agent user need separate policies: a policy on agent identities does not cover agent users.
Impact on users¶
Agent identities that ID Protection rates as high risk are blocked from signing in to all resources, including legitimate agents if the risk signal is a false positive. Agent users and agents acting on behalf of a user are not covered by this policy. Run it in Report-only first and check the sign-in logs for agents that would be blocked.
Rollback¶
Set Enable policy back to Report-only or Off. Keep the policy so you can switch it on again after the review.
Read-only check¶
Reads settings only. It changes nothing in your tenant or on the device.
Modules, connection and role
Requires: Microsoft.Graph (Conditional Access + agent identities), ExchangeOnlineManagement (audit search), Microsoft.PowerApps.Administration.PowerShell (data policies).
Connect first:
Connect-MgGraph -Scopes AgentIdentity.Read.All,Policy.Read.All
Connect-ExchangeOnline
Add-PowerAppsAccount
Note: Microsoft retires Search-UnifiedAuditLog on 15 Oct 2027 (MC1505599). AG04 will move to the Graph AuditLogQuery API before then.
$p = Get-MgIdentityConditionalAccessPolicy -All | Where-Object { ($_ | ConvertTo-Json -Depth 10) -match 'agent' }
if (-not $p) { 'No Conditional Access policy references agents' } else { $p | ForEach-Object { "$($_.DisplayName) [state: $($_.State)]" } }
How to verify¶
A policy targeting All agent identities with Agent risk = High and Block exists and is On (state: enabled) after the Report-only review.
Sources¶
This control is in the M365 AI Agent Hardening Kit
The free Top 5 has this control with its Jira import, Excel project plan, tracker CSV and the read-only PowerShell script. The Complete kit has all 20 controls.