Microsoft Entra Agent ID & Agent 365: Audit and Govern Non-Human AI Identities with Graph PowerShell

At Microsoft Ignite 2026, Microsoft unveiled Microsoft Entra Agent ID (Preview) under the Agent 365 control plane—marking a fundamental architectural shift in enterprise identity management. As organizations deploy autonomous AI agents across Microsoft 365 Copilot Studio, Azure AI Foundry, GitHub Copilot CLI, and endpoint execution containers, non-human agent identities now outnumber human employees in many tenants.

Without dedicated identity governance, AI agents often run under shared service principals or over-privileged user tokens, bypassing Multi-Factor Authentication (MFA) and creating massive lateral-movement blast radiuses. Entra Agent ID solves this by assigning every discovered cloud and local AI agent a distinct, managed workload identity with an explicit human sponsor/owner, separate Conditional Access policies, and continuous Global Secure Access telemetry.


Microsoft Entra Agent ID Governance Architecture

Microsoft Entra Agent ID & Agent 365 Zero Trust Control Plane 1. Agent Discovery Discovered via Defender, Intune Execution Containers & Global Secure Access. Assigns unique Entra Agent ID 2. Sponsor & Scope • Mandatory human Owner / Sponsor attribution • Scoped Graph API & Purview sensitivity label boundaries 3. Conditional Access • Workload Identity CA rules • Block untrusted IP egress • Auto-revoke on risk spike Continuous CAE Enforcement Key Governance Principle: Never allow autonomous AI agents to authenticate with delegated human credentials or ownerless service principals.

Step 1: Audit All Non-Human Workload & Agent Identities via Microsoft Graph

Use Microsoft Graph PowerShell (Application.Read.All, AuditLog.Read.All) to inventory all service principals and workload/agent identities in your tenant—flagging any agent identity that lacks an assigned human owner or holds high-privilege application permissions:

POWERSHELL
#Requires -Modules Microsoft.Graph.Authentication
<#
.SYNOPSIS
    Audits Entra ID Service Principals & AI Agent Identities for missing owners and high-risk app roles.
#>

Connect-MgGraph -Scopes "Application.Read.All", "Directory.Read.All"

Write-Host "[*] Querying first-party and custom Enterprise Application / Agent Principals..." -ForegroundColor Cyan
$Uri = "https://graph.microsoft.com/v1.0/servicePrincipals?`$filter=accountEnabled eq true&`$select=id,appId,displayName,servicePrincipalType,tags,createdDateTime&`$top=500"

$Principals = [System.Collections.Generic.List[object]]::new()
do {
    $Page = Invoke-MgGraphRequest -Method GET -Uri $Uri
    if ($Page.value) { $Principals.AddRange($Page.value) }
    $Uri = $Page.'@odata.nextLink'
} while ($Uri)

$Audit = [System.Collections.Generic.List[PSCustomObject]]::new()

foreach ($Sp in $Principals) {
    # Skip built-in Microsoft first-party resource APIs unless tagged as Agent/Custom
    if ($Sp.tags -notcontains "WindowsAzureActiveDirectoryIntegratedApp" -and $Sp.servicePrincipalType -eq "Legacy") { continue }

    $Owners = (Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/servicePrincipals/$($Sp.id)/owners?`$select=userPrincipalName").value
    $AppRoles = (Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/servicePrincipals/$($Sp.id)/appRoleAssignments").value

    $Audit.Add([PSCustomObject]@{
        DisplayName          = $Sp.displayName
        AppId                = $Sp.appId
        ObjectId             = $Sp.id
        PrincipalType        = $Sp.servicePrincipalType
        OwnerCount           = $Owners.Count
        Owners               = ($Owners.userPrincipalName -join "; ")
        AppPermissionCount   = $AppRoles.Count
        GovernanceStatus     = if ($Owners.Count -eq 0) { "CRITICAL: Ownerless Identity" } else { "Governed" }
    })
}

$Audit | Sort-Object OwnerCount, AppPermissionCount -Descending |
    Export-Csv ".\Entra-Agent-Workload-Identity-Audit.csv" -NoTypeInformation -Encoding UTF8

Write-Host "[+] Exported $($Audit.Count) workload/agent identities to Entra-Agent-Workload-Identity-Audit.csv" -ForegroundColor Green

Step 2: Enforce Conditional Access for Workload & Agent Identities

With Microsoft Entra Conditional Access for Workload Identities, create a dedicated policy scoping non-human principals:

  1. In the Microsoft Entra admin center (entra.microsoft.com), navigate to Protection > Conditional Access > Policies > New policy.
  2. Under Workload identities, select All owned service principals and Agent IDs (or target a security/custom attribute set for AI Agents).
  3. Under Conditions > Locations or Workload identity risk:

- Block access when Workload identity risk is Medium or High. - Block access from any IP outside your approved Named Locations (Azure VNet NAT IPs / Global Secure Access egress).

For deeper zero-trust sandboxing of dynamic AI agent permissions, read our companion Governing AI Agent Dynamic Permissions in Entra ID Runbook and Entra ID Access Package Drift Reports Guide.