Skip to content

entraadm-mcp

MCP server for Microsoft Entra ID sign-in and audit-log triage. Read-only, except for one opt-in tool.

Built for triaging "why can't this person sign in" reports without a human manually pulling sign-in logs, translating AADSTS codes, and checking the directory audit trail by hand — three separate steps that closed a real 2026-08-21 support case at this server's origin.

Why this instead of the official Microsoft MCP Server for Enterprise

Microsoft ships an official MCP Server for Enterprise for Entra ID data. It is a good fit for an interactive admin at a keyboard, and not a fit for an unattended triage bot:

  • Delegated auth only — no app-only (client credentials) support, so it cannot run headless behind a service account. entraadm-mcp is built for that case.
  • A general-purpose Graph query tool, not a fixed tool set — the official server exposes one tool that lets the model construct arbitrary Graph calls, which is awkward to put behind an allow-list for an automated triage profile.
  • No AADSTS translation and no cross-request aggregation — sign-in failures come back as raw codes, and Microsoft Graph itself cannot filter sign-ins on status/errorCode server-side or flag password-spray patterns.

Tools

Tool Purpose
health_check Is Graph reachable, and can this credential read sign-in logs?
get_user Account lifecycle state: enabled, on-prem sync, password age, licenses, sign-in activity
signin_logs One user's sign-in events, each AADSTS error code annotated with what it means
signin_failure_stats Tenant-wide failure aggregation: top error codes, users, apps, source IPs, and password-spray suspects
signin_success_stats Tenant-wide success aggregation by source IP: IPs shared by several accounts, legacy-auth (SMTP/IMAP) successes — the view that finds a breach
compromise_suspects Which accounts were probably taken over: an outside IP that sprayed many accounts and got into some (spray_breaches), successes from outside the home countries (foreign_successes, high when over a legacy protocol, through Azure CLI / PowerShell, or from 3+ countries within 24 hours), and Microsoft's own risky users when the tenant has Entra ID P2
signin_by_ip Every sign-in from one source IP: who got in from it, who was tried, and when
directory_audits Who changed what in the directory (block/unblock, attribute edits), and when
get_user_auth_methods Is MFA actually registered for this account?
list_subscriptions Which Azure subscriptions this credential can see (ARM)
vm_backup_status Which Azure VMs are backed up, whether the last backup succeeded, and whether a recovery point is stale (ARM)
vm_backup_policies Schedule and retention of the Azure VM backup policies (ARM)
vm_activity Who or what restarted an Azure VM: activity log and Resource Health for a time window (ARM)
m365_service_health Microsoft 365 service status and the open incidents and advisories
audit_log_search_start Submit a Microsoft Purview audit log search: what an account or an IP did in OneDrive/SharePoint, Exchange and Entra
audit_log_search_result That search's status, then its records summarised (by operation, service, record type, user, client IP) and trimmed
daily_brief One-call summary combining m365_service_health, signin_failure_stats, directory_audits and compromise_suspects (counts and top 5)

All tools above are read-only (audit_log_search_start creates only the saved audit search it then reads). The one state-changing tool, revoke_sign_in_sessions (sign one account out everywhere: Graph revokeSignInSessions), is registered only when ENTRAADM_ENABLE_REVOKE_SESSIONS=1 and needs User.RevokeSessions.All (app-only) or the User Administrator / Helpdesk Administrator role (delegated). It refuses guests and returns not_covered (no account disable, no password reset, no MFA removal; issued access tokens live until they expire); revoked: null means the outcome is unknown and calling again is safe. Leave the switch unset on any deployment without its own approval step. Unblocking an account and resetting a password stay out of scope.

Design notes

One process, several tenants (optional). Unset ENTRAADM_CONFIG is one tenant from the env vars. Set, it names an INI file of [tenant.<name>] sections, the counterpart of gwsadm-mcp's [domain.*]: UPN-taking tools route by the UPN's domain, tenant-wide tools take tenant, health_check and daily_brief cover every tenant, and the ARM tools stay on the default tenant. See the README's "Several tenants".

Two auth modes, chosen by which env vars are set. All three of ENTRAADM_TENANT_ID/_CLIENT_ID/_CLIENT_SECRET selects app-only (ClientSecretCredential) — the production path for a headless deployment. None of the three selects delegated auth via the current az login session (AzureCliCredential) — convenient for local development, but not every tool works under it (get_user_auth_methods needs an application permission that has no delegated equivalent in a typical role assignment). Setting one or two of the three is treated as a configuration error, not a silent fallback.

A missing permission degrades, it never crashes. Every tool that needs AuditLog.Read.All (or, under delegated auth, the Reports Reader directory role) reports the gap as {"error": "...", "missing_permission": "..."} with a human-readable explanation of what to grant — not a stack trace, and not a generic "forbidden." health_check's signin_probe field reports this same gap at the server level (status: "degraded") so a caller knows before trying any of the other tools.

A nonexistent account is a normal answer, not an error. get_user and get_user_auth_methods respond to a typo'd or nonexistent userPrincipalName with {"found": false, ...}, distinct from the error key used for an actual failure (bad input shape, unreachable Graph, missing permission).

Sign-in log retention is 30 days (Entra ID P1). A window beyond that returns an empty result, not an error — there's nothing there to find, and that's a legitimate answer.

Next steps

  • Reference — every tool's parameters, the auth model, and CLI usage