AI Agent & Non-Human Identity Governance
AI agents — Microsoft 365 Copilot Studio agents, Microsoft Foundry agents, custom-built
ones, plus traditional service principals and managed identities — are now the
fastest-growing identity population in most tenants. They authenticate, hold permissions,
act on behalf of users (or themselves), and are usually under-governed.
This skill is the lifecycle governance layer for those identities: ownership, scoping,
credential hygiene, reviews, decommissioning, and incident response.
When to use
Establishing or maturing governance for the agent / NHI population — Copilot Studio
agents, Foundry agents, custom LLM agents, and the service principals that back them.
Do not use this skill for workload identity federation patterns alone
(entra-workload-identity), human identity governance (entra-id-governance), or
generic agent build guidance.
Agent identity inventory — know what you're governing
| Class |
Identity model |
Surface |
| Copilot Studio agent (M365) |
Tenant-scoped agent identity + per-user delegated permissions |
M365 admin center / Copilot Studio |
| Microsoft Foundry agent |
Service principal + managed identity + per-user OBO |
Azure portal / Foundry |
| Custom AI agent (your code) |
App registration + workload identity federation / managed identity |
Entra admin center |
| Plugin / connector |
Service principal + delegated/app Graph permissions |
Entra admin center |
| Legacy automation service principal |
App registration, often with secret |
Entra admin center |
Approach
Inventory and tag. Pull every app registration, service principal, and Copilot
Studio / Foundry agent. Tag each with:
- Owner (person + group).
- Sponsor / business owner.
- Purpose (one sentence).
- Data scope (which tenants/sites/mailboxes/resources).
- Lifecycle stage (pilot / production / sunset).
- Criticality (tier 0 / 1 / 2).
Orphaned identities → freeze them; require owner re-claim.
Scope permissions tightly.
- Microsoft Graph: prefer Sites.Selected over
Sites.Read.All, mailbox
scoping via Application Access Policy over Mail.Send, custom security
attributes over broad directory roles.
- Azure: scope role assignments at RG or resource, never subscription Owner unless
truly required.
- Copilot Studio agent knowledge sources: explicit site/library lists, not "All
SharePoint."
- Foundry agent tools: only the tools needed; remove
http plugin unless
necessary.
Credential hygiene. No client secrets in new builds — federated credentials
(GitHub Actions, Azure DevOps, AKS, external OIDC) or certificates with auto-rotation
via Key Vault. Existing secrets: inventory, cap expiry at 180 days, rotate via
automation, plan migration to federation.
Conditional Access for workloads (Workload Identities Premium). Apply to
tier-0 agents and externally-callable agents:
- Restrict source IP ranges.
- Block legacy auth.
- Require named locations.
Don't try to apply to every SP in the tenant — focus on high-blast-radius identities.
Access reviews for agents via Entra ID Governance. Owner reviews per quarter:
- Still needed?
- Still the right scope?
- Credential rotation up to date?
- Owner / sponsor still in role?
Auto-disable on owner non-response.
Lifecycle workflows. Build automation for:
- Provisioning: owner-initiated request → approval → SP created with template
permissions, tagged, owner assigned.
- Modification: scope change requires re-approval.
- Decommissioning: 30-day disable window, then delete; remove role
assignments, federated credentials, knowledge-source attachments.
Audit and monitoring.
- Stream
ServicePrincipalSignInLogs and AuditLogs to Sentinel.
- For Copilot Studio agents: interaction audit logs via Purview Audit.
- Detections:
- New high-privilege role assignment to an agent identity.
- Agent sign-in from unexpected IP/country.
- Sudden spike in Graph API calls per agent.
- Sensitive data access by agent outside business hours.
- New credential added to an agent by an identity other than its owner.
Incident response when an agent is compromised.
- Disable the identity (block sign-in on the app registration / SP).
- Rotate credentials, revoke refresh tokens.
- Hunt actions taken by the agent identity in the past 7–30 days
(Graph audit, resource activity).
- Notify data owners for the resources the agent had access to.
- Root cause (leaked secret? OAuth consent phishing? supply chain?).
- Restore with tightened scope or retire.
Couple with usage signals. Purview AI Hub / DSPM for AI shows what the agent
does (sensitive data flowing through prompts). Pair with identity audit to get a
complete view.
Guardrails
- Every agent identity has a named human owner. Empty owners list = orphan =
audit/security risk.
- No client secrets for new identities. Federation > certificate > secret.
- Sites.Selected (and similar) is mandatory where it exists. "Quick start with
.All and we'll scope later" never scopes later.
- Conditional Access for workloads is a separate license. Confirm SKU before
designing.
- OAuth consent for new agents must be admin-reviewed. End-user consent for high-
privilege scopes is the agent equivalent of a phishing onboarding.
- Decommissioned ≠ deleted in 1 day. 30-day disable window catches "wait, that was
in use somewhere."
- Agent credentials are not for human use. Don't share an agent's secret with the
team for "easier debugging."
- Tag agents with data scope and tier. Without it, IR and reviews are guesswork.
Common anti-patterns
- "Copilot Studio agent grounded on 'All SharePoint'" — same oversharing problem as
Copilot itself, scaled. Use site-scoped knowledge sources.
- "Agent SP granted Mail.Send Application permission tenant-wide" — can email as
anyone. Use app access policies to scope to specific mailboxes.
- "Owner field set to a leaver's account" — orphaned, no review, no rotation.
- "Long-lived client secret in agent code" — git history forever; leak detection
too late.
- "All agents in tier-0 because 'they're all important'" — review and IR effort
becomes uniform but is uniformly low quality. Real tiering.
- "Decommissioned by deleting the app reg, leaving role assignments behind" —
dangling principal IDs in RBAC; restore-with-same-id risk.
- "No audit on Copilot Studio agent interactions" — compromised agent acts
invisibly.
- "Treated agent identity governance as identical to human IGA" — different
lifecycle, different controls, different reviews.
Example prompts
Inventory all Copilot Studio agents, Foundry agents, and service principals in the tenant and produce an owner + scope + tier report.
Roll out access reviews for 600 agent identities via Entra ID Governance quarterly.
Scope a Copilot Studio agent for HR from "All SharePoint" to 4 specific knowledge sites.
Build a decommissioning workflow: 30-day disable, owner notification, full cleanup of RBAC and federated credentials.
Sentinel detections for agent identity compromise: new credential, anomalous sign-in, spike in Graph calls.
IR runbook: compromised Foundry agent that called Microsoft Graph for 48 hours — containment, hunt, notification.
Replace client secrets across 120 legacy automation SPs with workload identity federation or Key Vault certificates.
Apply Conditional Access for workload identities to all tier-0 agents.
Microsoft Learn
1---2name: agent-identity-governance3description: Guidance for governing the identities of AI agents and non-human identities (NHIs) — Microsoft 365 Copilot Studio agents, Microsoft Foundry agents, custom AI agents, and traditional service principals/managed identities — through their full lifecycle. Covers ownership and tagging, scoped permissions and consent (delegated vs application; Sites.Selected; mailbox-scoped Graph), credential hygiene (federated credentials, certificates, no secrets), Conditional Access for workloads, agent-level access reviews via Entra ID Governance, lifecycle workflows for agent decommissioning, audit (agent prompts, agent actions, agent identity sign-ins), incident response when an agent is compromised, and integration with Purview AI Hub for usage signals. WHEN: AI agent identity governance, non-human identity governance, NHI lifecycle, Copilot Studio agent identity, Foundry agent governance, agent service principal, scoped Graph permissions agent, agent access review, decommission AI agent, agent credential rotation, compromis4license: MIT5---67# AI Agent & Non-Human Identity Governance89AI agents — Microsoft 365 Copilot Studio agents, Microsoft Foundry agents, custom-built10ones, plus traditional service principals and managed identities — are now the11fastest-growing identity population in most tenants. They authenticate, hold permissions,12act on behalf of users (or themselves), and are usually under-governed.1314This skill is the lifecycle governance layer for those identities: ownership, scoping,15credential hygiene, reviews, decommissioning, and incident response.1617## When to use18Establishing or maturing governance for the agent / NHI population — Copilot Studio19agents, Foundry agents, custom LLM agents, and the service principals that back them.2021**Do not use this skill** for workload identity federation patterns alone22(`entra-workload-identity`), human identity governance (`entra-id-governance`), or23generic agent build guidance.2425## Agent identity inventory — know what you're governing2627| Class | Identity model | Surface |28|---|---|---|29| **Copilot Studio agent (M365)** | Tenant-scoped agent identity + per-user delegated permissions | M365 admin center / Copilot Studio |30| **Microsoft Foundry agent** | Service principal + managed identity + per-user OBO | Azure portal / Foundry |31| **Custom AI agent (your code)** | App registration + workload identity federation / managed identity | Entra admin center |32| **Plugin / connector** | Service principal + delegated/app Graph permissions | Entra admin center |33| **Legacy automation service principal** | App registration, often with secret | Entra admin center |3435## Approach36371. **Inventory and tag.** Pull every app registration, service principal, and Copilot38 Studio / Foundry agent. Tag each with:39 - **Owner** (person + group).40 - **Sponsor / business owner**.41 - **Purpose** (one sentence).42 - **Data scope** (which tenants/sites/mailboxes/resources).43 - **Lifecycle stage** (pilot / production / sunset).44 - **Criticality** (tier 0 / 1 / 2).45 Orphaned identities → freeze them; require owner re-claim.46472. **Scope permissions tightly.**48 - Microsoft Graph: prefer **Sites.Selected** over `Sites.Read.All`, **mailbox49 scoping via Application Access Policy** over `Mail.Send`, custom security50 attributes over broad directory roles.51 - Azure: scope role assignments at RG or resource, never subscription Owner unless52 truly required.53 - Copilot Studio agent knowledge sources: explicit site/library lists, not "All54 SharePoint."55 - Foundry agent tools: only the tools needed; remove `http` plugin unless56 necessary.57583. **Credential hygiene.** No client secrets in new builds — federated credentials59 (GitHub Actions, Azure DevOps, AKS, external OIDC) or certificates with auto-rotation60 via Key Vault. Existing secrets: inventory, cap expiry at 180 days, rotate via61 automation, plan migration to federation.62634. **Conditional Access for workloads** (Workload Identities Premium). Apply to64 tier-0 agents and externally-callable agents:65 - Restrict source IP ranges.66 - Block legacy auth.67 - Require named locations.68 Don't try to apply to every SP in the tenant — focus on high-blast-radius identities.69705. **Access reviews for agents** via Entra ID Governance. Owner reviews per quarter:71 - Still needed?72 - Still the right scope?73 - Credential rotation up to date?74 - Owner / sponsor still in role?75 Auto-disable on owner non-response.76776. **Lifecycle workflows.** Build automation for:78 - **Provisioning**: owner-initiated request → approval → SP created with template79 permissions, tagged, owner assigned.80 - **Modification**: scope change requires re-approval.81 - **Decommissioning**: 30-day disable window, then delete; remove role82 assignments, federated credentials, knowledge-source attachments.83847. **Audit and monitoring.**85 - Stream `ServicePrincipalSignInLogs` and `AuditLogs` to Sentinel.86 - For Copilot Studio agents: interaction audit logs via Purview Audit.87 - Detections:88 - New high-privilege role assignment to an agent identity.89 - Agent sign-in from unexpected IP/country.90 - Sudden spike in Graph API calls per agent.91 - Sensitive data access by agent outside business hours.92 - New credential added to an agent by an identity other than its owner.93948. **Incident response when an agent is compromised.**95 1. **Disable the identity** (block sign-in on the app registration / SP).96 2. **Rotate credentials**, revoke refresh tokens.97 3. **Hunt actions** taken by the agent identity in the past 7–30 days98 (Graph audit, resource activity).99 4. **Notify data owners** for the resources the agent had access to.100 5. **Root cause** (leaked secret? OAuth consent phishing? supply chain?).101 6. **Restore with tightened scope** or retire.1021039. **Couple with usage signals.** Purview AI Hub / DSPM for AI shows *what the agent104 does* (sensitive data flowing through prompts). Pair with identity audit to get a105 complete view.106107## Guardrails108- **Every agent identity has a named human owner.** Empty owners list = orphan =109 audit/security risk.110- **No client secrets for new identities.** Federation > certificate > secret.111- **Sites.Selected (and similar) is mandatory where it exists.** "Quick start with112 `.All` and we'll scope later" never scopes later.113- **Conditional Access for workloads is a separate license.** Confirm SKU before114 designing.115- **OAuth consent for new agents must be admin-reviewed.** End-user consent for high-116 privilege scopes is the agent equivalent of a phishing onboarding.117- **Decommissioned ≠ deleted in 1 day.** 30-day disable window catches "wait, that was118 in use somewhere."119- **Agent credentials are not for human use.** Don't share an agent's secret with the120 team for "easier debugging."121- **Tag agents with data scope and tier.** Without it, IR and reviews are guesswork.122123## Common anti-patterns124- **"Copilot Studio agent grounded on 'All SharePoint'"** — same oversharing problem as125 Copilot itself, scaled. Use site-scoped knowledge sources.126- **"Agent SP granted Mail.Send Application permission tenant-wide"** — can email as127 anyone. Use app access policies to scope to specific mailboxes.128- **"Owner field set to a leaver's account"** — orphaned, no review, no rotation.129- **"Long-lived client secret in agent code"** — git history forever; leak detection130 too late.131- **"All agents in tier-0 because 'they're all important'"** — review and IR effort132 becomes uniform but is uniformly low quality. Real tiering.133- **"Decommissioned by deleting the app reg, leaving role assignments behind"** —134 dangling principal IDs in RBAC; restore-with-same-id risk.135- **"No audit on Copilot Studio agent interactions"** — compromised agent acts136 invisibly.137- **"Treated agent identity governance as identical to human IGA"** — different138 lifecycle, different controls, different reviews.139140## Example prompts141- `Inventory all Copilot Studio agents, Foundry agents, and service principals in the142 tenant and produce an owner + scope + tier report.`143- `Roll out access reviews for 600 agent identities via Entra ID Governance quarterly.`144- `Scope a Copilot Studio agent for HR from "All SharePoint" to 4 specific knowledge145 sites.`146- `Build a decommissioning workflow: 30-day disable, owner notification, full cleanup of147 RBAC and federated credentials.`148- `Sentinel detections for agent identity compromise: new credential, anomalous sign-in,149 spike in Graph calls.`150- `IR runbook: compromised Foundry agent that called Microsoft Graph for 48 hours —151 containment, hunt, notification.`152- `Replace client secrets across 120 legacy automation SPs with workload identity153 federation or Key Vault certificates.`154- `Apply Conditional Access for workload identities to all tier-0 agents.`155156## Microsoft Learn157- Workload identities overview: https://learn.microsoft.com/entra/workload-id/workload-identities-overview158- Entra ID Governance overview: https://learn.microsoft.com/entra/id-governance/identity-governance-overview159- Access reviews for service principals: https://learn.microsoft.com/entra/id-governance/create-access-review160- Conditional Access for workload identities: https://learn.microsoft.com/entra/identity/conditional-access/workload-identity161- Application access policies (Graph mailbox scoping): https://learn.microsoft.com/graph/auth-limit-mailbox-access162- Sites.Selected: https://learn.microsoft.com/sharepoint/dev/solution-guidance/security-apponly-azuread163- Copilot Studio security and governance: https://learn.microsoft.com/microsoft-copilot-studio/security-and-governance164- Microsoft Foundry agent security: https://learn.microsoft.com/azure/ai-foundry/concepts/ai-resources165- Audit (unified) for Copilot: https://learn.microsoft.com/purview/audit-copilot166- Workload identity federation: https://learn.microsoft.com/entra/workload-id/workload-identity-federation