implement-agent-id

A guide for building integrations with Microsoft Entra Agent ID and Agent User, Microsoft's identity systems for software agents. It covers authentication, permissions, identity creation, and the flow used to obtain user-linked tokens.

In plain words
What is it for?
It is for implementing certificate-based authentication, creating agent identities and users, granting consent, and handling the three-step user-linked token flow.
Why use it?
It keeps identity implementations aligned with the documented object relationships, API versions, permissions, and authentication constraints.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/microsoft/entrabot/implement-agent-id
Any agent
npx skills add microsoft/entrabot --skill implement-agent-id
Clone the repo
git clone --depth 1 https://github.com/microsoft/entrabot

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,811 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.01811
Opus 5 $0.00023 $0.00905
Sonnet 5 $0.00009 $0.00362
Haiku 4.5 $0.00005 $0.00181

Measured 2d ago against content hash 0375afc3cf3a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

implement-agent-id scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

result = subprocess.run(
.claude/skills/implement-agent-id/SKILL.md · 218 lines

How it starts

The opening of the file, as written. The whole thing — 218 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implementing Microsoft Entra Agent ID

Read these repository sources before changing identity or token code:

  • docs/platform-docs/agent-id-blueprints-and-users.md
  • docs/platform-docs/entra-agent-users.md
  • docs/platform-docs/delegated-auth.md
  • docs/reference/token-flows.md
  • engineering-history/research/hard-won-learnings.md

Microsoft Entra Agent ID and Microsoft Agent 365 reached GA on 2026-05-01, but not every related API is on Microsoft Graph v1.0. Use the endpoint version documented for each object rather than treating the whole surface as beta or stable.

Object model

Agent Identity Blueprint (application)
  └─ AgentIdentityBlueprintPrincipal (service principal; create explicitly)
      ├─ Agent Identity (service principal)
      └─ Agent Identity (service principal)
           └─ Agent User (user; linked through user_fic)

An Agent Identity is a service principal, not a user. Do not create a password-backed fake user to represent an agent.

Non-negotiable constraints

Use a dedicated provisioner identity

Azure CLI user tokens contain Directory.AccessAsUser.All; Agent Identity APIs reject those tokens with a hard 403. Use Azure CLI only to bootstrap the dedicated provisioner app and identify the signed-in sponsor.

The provisioner authenticates with a certificate credential. Keep the private key in the OS credential store and purge legacy password credentials. Entrabot implements this in:

  • scripts/entra_provisioning.py
  • scripts/create_entra_agent_ids.py

Do not add a client secret fallback.

Parse Azure CLI output as JSON

CLI warnings can corrupt TSV output. Request JSON and parse the id field:

result = subprocess.run(
    ["az", "ad", "signed-in-user", "show", "-o", "json"],
    check=True,
    capture_output=True,
    text=True,
)
user_id = json.loads(result.stdout)["id"]

Sponsors are user references

Blueprint and Agent Identity creation require at least one sponsor. Bind a Microsoft Graph v1.0 user reference:

Read the full file on GitHub · 218 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 218 lines · 45 tokens per session scan A 0375afc3cf3a

Subscribe to this mod's changes

implement-agent-id is a skill published in the GitHub repository microsoft/entrabot (9 stars, last pushed 19d ago), licensed MIT. It adds 45 tokens to every session and 1,811 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

agents-sdk-dotnet-activityhandler-migration

Use when migrating a Microsoft 365 Agents SDK agent that uses ActivityHandler or TeamsActivityHandler to AgentApplication. This is ONLY for DotNet projects that uses Microsoft.Agents. packages. Triggered by Agents SDK bots that subclass ActivityHandler or TeamsActivityHandler that need to be modernized to…

microsoft/Agents · 76 tokens

agents-sdk-typescript

Use when any code imports @microsoft/agents-hosting, @microsoft/agents-hosting-express, or related Agents SDK packages, or when the user is building, configuring, or asking questions about a Microsoft 365 Agents SDK agent in TypeScript. Trigger on questions about environment variables, connection configuration…

microsoft/Agents · 111 tokens

agents-sdk-dotnet

Use when any code imports Microsoft.Agents.Hosting.AspNetCore, Microsoft.Agents.Builder, or related Agents SDK packages, or when the user is building, configuring, or asking questions about a Microsoft 365 Agents SDK agent in C# / .NET. Trigger on questions about appsettings.json, connection configuration…

microsoft/Agents · 112 tokens

agents-sdk-provision

Use when provisioning Azure resources for a Microsoft Agents SDK application — including creating an Azure Bot Service resource, setting up Entra app registrations, configuring identity credentials (UserManagedIdentity, FederatedCredentials, or ClientSecret), adding a Teams channel, running Bicep deployments for SSO…

microsoft/Agents · 131 tokens

bf-to-agents-sdk-typescript-migration

Assess and migrate JavaScript or TypeScript bots from BotBuilder/Bot Framework SDK to Microsoft 365 Agents SDK with AgentApplication. Use to produce a migration report and plan before editing code, map BotBuilder packages and APIs, identify unsupported features, and implement only the supported plan items selected by…

microsoft/Agents · 71 tokens

skill-creator

Create, refine, and benchmark agent skills. Use when building a new skill, updating an existing one, running evals, checking trigger quality, or improving a skill description.

feiskyer/claude-code-settings · 39 tokens