agentleFS
MicrosoftKnown publishermicrosoft/entra-agentid-samples/.claude/skills/entra-agent-id-setup/SKILL.md

entra-agent-id-setup

Skill12 starsChanged 7 months agoMITView on GitHub

AI-guided setup for Microsoft Entra Agent ID. Use when the user wants to provision an Agent Identity Blueprint, Agent Identity, and OBO client app in an Entra tenant; when configuring the dev/AWS/GCP sidecar stack; when debugging 403 Authorization_RequestDenied on blueprint creation; when checking which Entra role is required (Global Admin / Agent ID Administrator / Agent ID Developer); when running Start-EntraAgentIDWorkflow / setup-obo-client-app / setup-obo-blueprint.

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    MFA: If the signing-in user was just created, they MUST complete MFA enrollment via browser first (AADSTS50079).

    line 30
  2. Distinctive:

    Run the end-to-end workflow.

    line 36
  3. Very specific:

    Write $r.Blueprint.BlueprintAppId, $r.Blueprint.ClientSecret, and $r.Agent.AgentIdentityAppId into sidecar/dev/.env as BLUEPRINT_APP_ID, …

    line 52
  4. Very specific:

    Verify: curl http://localhost:3003/api/status returns agent_app_id, ollama_available, sidecar_url.

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Entra Agent ID Setup (AI-Guided)

End-to-end provisioning of a Microsoft Entra Agent Identity + OBO-capable client app, plus bringing up the sidecar stack.

When to Use

  • User says: "set up agent ID", "create blueprint", "provision agent identity", "configure OBO", "set up the sidecar"
  • User hits 403 Authorization_RequestDenied when creating a blueprint
  • User asks what Entra role is needed for agent ID
  • User wants to go from empty tenant → working autonomous + OBO flows

Prerequisites (verify BEFORE running scripts)

  1. Entra role assigned to the signing-in user. One of:
    • Global Administrator
    • Agent ID Administrator (template db506228-d27e-4b7d-95e5-295956d6615f)
    • Agent ID Developer (template adb2368d-a9be-41b5-8667-d96778e081b0)
    • Application Administrator and Cloud Application Administrator are NOT sufficient — they cannot create agentIdentityBlueprints (verified: 403 on POST /beta/applications/ with @odata.type: Microsoft.Graph.AgentIdentityBlueprint). See references/permissions.md.
  2. Tenant features: Agent Identity APIs enabled. AgentUser entity type is feature-gated per-tenant — not required for autonomous/OBO flows; removed from our scripts. See references/troubleshooting.md.
  3. Tooling:
    • Azure CLI (az) signed in to the target tenant
    • PowerShell 7+ (pwsh)
    • Microsoft.Graph.Authentication and Microsoft.Graph.Beta.Applications PowerShell modules (install: Install-Module Microsoft.Graph.Authentication, Microsoft.Graph.Beta.Applications -Scope CurrentUser)
    • Docker Desktop (only for local docker-compose in Step 4; not needed for ACA deployments — see deploy-agent-aca-dev)
  4. MFA: If the signing-in user was just created, they MUST complete MFA enrollment via browser first (AADSTS50079). Password-only az login -u -p will fail.

Procedure

Step 1 — Create Blueprint + Agent Identity

Run the end-to-end workflow. Creates Blueprint app, Blueprint SP, client secret, Agent Identity, and assigns Graph permissions.

[!WARNING] Run Connect-MgGraph in an interactive pwsh session, not via pwsh -Command "Connect-MgGraph ..." subshell. The WAM authentication popup hides behind other windows in a subshell and silently times out.

[!NOTE] The scope list below must match what EntraAgentID-Functions.ps1 validates internally (10 scopes). If you omit any, the script throws Missing required Microsoft Graph scopes.

pwsh
. /path/to/repo/scripts/EntraAgentID-Functions.ps1
Connect-MgGraph -Scopes "AgentIdentityBlueprint.AddRemoveCreds.All","AgentIdentityBlueprint.Create","AgentIdentityBlueprint.DeleteRestore.All","AgentIdentity.DeleteRestore.All","DelegatedPermissionGrant.ReadWrite.All","Application.Read.All","AgentIdentityBlueprintPrincipal.Create","AppRoleAssignment.ReadWrite.All","Directory.Read.All","User.Read" -TenantId <tenant-id>

$r = Start-EntraAgentIDWorkflow -BlueprintName "Demo Blueprint" -AgentName "Weather Agent" -Permissions @("User.Read.All")

Write $r.Blueprint.BlueprintAppId, $r.Blueprint.ClientSecret, and $r.Agent.AgentIdentityAppId into sidecar/dev/.env as BLUEPRINT_APP_ID, BLUEPRINT_CLIENT_SECRET, AGENT_CLIENT_ID, plus TENANT_ID.

Supporting script: EntraAgentID-Functions.ps1

Step 2 — Register OBO Client SPA

pwsh /path/to/repo/scripts/setup-obo-client-app.ps1

Creates an Entra app with SPA redirect URI http://localhost:3003 and appends CLIENT_SPA_APP_ID=<id> to the detected .env.

Supporting script: setup-obo-client-app.ps1 (bash: setup-obo-client-app.sh)

Step 3 — Configure Blueprint for OBO

pwsh /path/to/repo/scripts/setup-obo-blueprint.ps1 `
    -BlueprintAppId <blueprint-id> `
    -AgentAppId <agent-id> `
    -ClientSpaAppId <spa-id> `
    -TenantId <tenant-id>

This sets api://<blueprint> as App ID URI, adds the access_as_user delegated scope, adds API permission on the Client SPA, and grants admin consent for both Agent→Graph (User.Read) and Client SPA→Blueprint (access_as_user).

Supporting script: setup-obo-blueprint.ps1 (bash: setup-obo-blueprint.sh)

Step 4 — Bring Up Sidecar Stack

cd sidecar/dev
docker compose --env-file .env up --build -d

Verify: curl http://localhost:3003/api/status returns agent_app_id, ollama_available, sidecar_url.

Step 5 — Test Flows

  • Autonomous Direct: curl -s -X POST http://localhost:3003/api/chat -H 'Content-Type: application/json' -d '{"message":"weather in seattle","use_langchain":false,"token_flow":"autonomous"}' → should return Seattle weather; TR token roles: [User.Read.All].
  • OBO: open http://localhost:3003 in a browser, sign in with MSAL popup, chat with token_flow: obo.

Key Artifacts (for reuse)

Persist these in sidecar/<target>/.env:

  • TENANT_ID
  • BLUEPRINT_APP_ID
  • BLUEPRINT_CLIENT_SECRET
  • AGENT_CLIENT_ID
  • CLIENT_SPA_APP_ID

References

  • Required permissions and role comparison
  • Troubleshooting matrix
  • Graph API call sequence

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.