entra-agent-id
microsoft/skills
Microsoft Graph 베타 API를 사용하여 AI 에이전트용 OAuth 2.0 지원 ID를 생성하고 관리합니다.
...모든 것을 확장하십시오Microsoft Entra 에이전트 ID
Microsoft Graph 베타 API를 사용하여 AI 에이전트용 OAuth 2.0 지원 ID를 생성하고 관리합니다.
프리뷰 API — 모든 에이전트 ID 엔드포인트는
/beta로만 제공됩니다. 다음에서는 사용할 수 없습니다/v1.0.
시작하기 전에
검색 microsoft-docs MCP에서 최신 에이전트 ID 문서를 검색하세요:
- 쿼리: "Microsoft Entra 에이전트 ID 설정"
- 확인: API 매개변수가 현재 프리뷰 동작과 일치하는지 확인
개념 모델
Agent Identity Blueprint (application) ← one per agent type/project
└── BlueprintPrincipal (service principal) ← MUST be created explicitly
├── Agent Identity (SP): agent-1 ← one per agent instance
├── Agent Identity (SP): agent-2
└── Agent Identity (SP): agent-3
필수 조건
PowerShell (대화형 설정에 권장)
# Requires PowerShell 7+
Install-Module Microsoft.Graph.Beta.Applications -Scope CurrentUser -Force
Python(프로그래밍 방식 프로비저닝용)
pip install azure-identity requests
필요한 Entra 역할
다음 중 하나: 에이전트 ID 개발자, 에이전트 ID 관리자 또는 애플리케이션 관리자.
환경 변수
AZURE_TENANT_ID=
AZURE_CLIENT_ID=
AZURE_CLIENT_SECRET=
인증
⚠️
DefaultAzureCredential는 지원되지 않습니다. Azure CLI 토큰에는Directory.AccessAsUser.All가 포함되어 있으며, 에이전트 ID API는 이를 명시적으로 거부합니다(403). 반드시 전용 앱 등록을 사용하여client_credentialsflow를 사용하거나 명시적인 위임 범위를 사용하여Connect-MgGraph명시적인 위임 범위를 사용하여 연결해야 합니다.
PowerShell(위임된 권한)
Connect-MgGraph -Scopes @(
"AgentIdentityBlueprint.Create",
"AgentIdentityBlueprint.ReadWrite.All",
"AgentIdentityBlueprintPrincipal.Create",
"User.Read"
)
Set-MgRequestContext -ApiVersion beta
$currentUser = (Get-MgContext).Account
$userId = (Get-MgUser -UserId $currentUser).Id
Python(애플리케이션 권한)
import os
import requests
from azure.identity import ClientSecretCredential
credential = ClientSecretCredential(
tenant_id=os.environ["AZURE_TENANT_ID"],
client_id=os.environ["AZURE_CLIENT_ID"],
client_secret=os.environ["AZURE_CLIENT_SECRET"],
)
token = credential.get_token("https://graph.microsoft.com/.default")
GRAPH = "https://graph.microsoft.com/beta"
headers = {
"Authorization": f"Bearer {token.token}",
"Content-Type": "application/json",
"OData-Version": "4.0", # Required for all Agent Identity API calls
}
핵심 워크플로
1단계: 에이전트 ID 블루프린트 생성
스폰서가 필수이며, 반드시 User 개체여야 합니다. ServicePrincipals 및 Groups는 허용되지 않습니다.
import subprocess
# Get sponsor user ID (client_credentials has no user context, so use az CLI)
result = subprocess.run(
["az", "ad", "signed-in-user", "show", "--query", "id", "-o", "tsv"],
capture_output=True, text=True, check=True,
)
user_id = result.stdout.strip()
blueprint_body = {
"@odata.type": "Microsoft.Graph.AgentIdentityBlueprint",
"displayName": "My Agent Blueprint",
"[email protected]": [
f"https://graph.microsoft.com/beta/users/{user_id}"
],
}
resp = requests.post(f"{GRAPH}/applications", headers=headers, json=blueprint_body)
resp.raise_for_status()
blueprint = resp.json()
app_id = blueprint["appId"]
blueprint_obj_id = blueprint["id"]
2단계: BlueprintPrincipal 생성
이 단계는 필수입니다. 블루프린트를 생성한다고 해서 해당 서비스 주체가 자동으로 생성되지는 않습니다. 이 단계가 누락되면 에이전트 ID 생성이 실패하며 다음과 같은 오류가 발생합니다:
400: The Agent Blueprint Principal for the Agent Blueprint does not exist.
sp_body = {
"@odata.type": "Microsoft.Graph.AgentIdentityBlueprintPrincipal",
"appId": app_id,
}
resp = requests.post(f"{GRAPH}/servicePrincipals", headers=headers, json=sp_body)
resp.raise_for_status()
이멧포텐트 스크립트를 구현하는 경우, 블루프린트가 이미 존재하는 경우에도 BlueprintPrincipal을 확인하고 생성해야 합니다 (이전 실행에서 블루프린트가 생성되었으나 SP 생성 전에 스크립트가 중단되었을 수 있음).
3단계: 에이전트 ID 생성
agent_body = {
"@odata.type": "Microsoft.Graph.AgentIdentity",
"displayName": "my-agent-instance-1",
"agentIdentityBlueprintId": app_id,
"[email protected]": [
f"https://graph.microsoft.com/beta/users/{user_id}"
],
}
resp = requests.post(f"{GRAPH}/servicePrincipals", headers=headers, json=agent_body)
resp.raise_for_status()
agent = resp.json()
API 참조
| 작업 | 메서드 | 엔드포인트 | OData 유형 |
|---|---|---|---|
| 블루프린트 생성 | POST |
/applications |
Microsoft.Graph.AgentIdentityBlueprint |
| 블루프린트 생성 Principal | POST |
/servicePrincipals |
Microsoft.Graph.AgentIdentityBlueprintPrincipal |
| 에이전트 ID 생성 | POST |
/servicePrincipals |
Microsoft.Graph.AgentIdentity |
| 에이전트 ID 나열 | GET |
/servicePrincipals?$filter=... |
— |
| 에이전트 ID 삭제 | DELETE |
/servicePrincipals/{id} |
— |
| 블루프린트 삭제 | DELETE |
/applications/{id} |
— |
모든 엔드포인트는 기본 URL을 사용합니다: https://graph.microsoft.com/beta
필요한 권한
| 권한 | 목적 |
|---|---|
Application.ReadWrite.All |
블루프린트 CRUD (애플리케이션 객체) |
AgentIdentityBlueprint.Create |
새로운 블루프린트 생성 |
AgentIdentityBlueprint.ReadWrite.All |
블루프린트 읽기/업데이트 |
AgentIdentityBlueprintPrincipal.Create |
블루프린트 주체 생성 |
AgentIdentity.Create.All |
에이전트 식별자 생성 |
AgentIdentity.ReadWrite.All |
에이전트 ID 읽기/수정 |
에이전트 ID에 특화된 그래프 애플리케이션 권한은 총 18개입니다. 모두 확인하기:
az ad sp show --id 00000003-0000-0000-c000-000000000000 \
--query "appRoles[?contains(value, 'AgentIdentity')].{id:id, value:value}" -o json
관리자 동의 부여(애플리케이션 권한에 필수):
az ad app permission admin-consent --id
서비스 프린시펄이 복제되지 않은 경우 관리자 동의 요청이 404 오류로 실패할 수 있습니다. 10~40초의 대기 시간을 두고 다시 시도하십시오.
정리
# Delete Agent Identity
requests.delete(f"{GRAPH}/servicePrincipals/{agent['id']}", headers=headers)
# Delete BlueprintPrincipal (get SP ID first)
sps = requests.get(
f"{GRAPH}/servicePrincipals?$filter=appId eq '{app_id}'",
headers=headers,
).json()
for sp in sps.get("value", []):
requests.delete(f"{GRAPH}/servicePrincipals/{sp['id']}", headers=headers)
# Delete Blueprint
requests.delete(f"{GRAPH}/applications/{blueprint_obj_id}", headers=headers)
모범 사례
- BlueprintPrincipal은 항상 Blueprint 생성 후에 직접 생성하십시오(자동 생성되지 않음). 두 대상 모두에 대해 항등성 검사를 구현하십시오.
- 스폰서로 User 객체를 사용하십시오 — ServicePrincipals 및 Groups는 거부됩니다
- 권한 전파 지연 처리 — 관리자 동의 후 30~120초 대기; 403 오류 발생 시 백오프를 적용하여 재시도하십시오
- 모든 Graph 요청에 `
OData-Version: 4.0` 헤더를 포함하십시오 - 프로덕션 인증에는 Workload Identity Federation을 사용하십시오 — 로컬 개발 환경에서는 Blueprint에서 클라이언트 시크릿을 사용하십시오(references/oauth2-token-flow.md 참조)
- OAuth2 범위 지정을 사용하기 전에 Blueprint에서
identifierUris을 설정하십시오(api://{app-id}) - API 호출 시 Azure CLI 토큰을 절대 사용하지 마십시오. 해당 토큰에는
Directory.AccessAsUser.All이는 엄격하게 거부됩니다 - 생성하기 전에 기존 리소스가 있는지 확인 — 항등성 프로비저닝 구현
참조
| 파일 | 목차 |
|---|---|
| references/oauth2-token-flow.md | 프로덕션(관리형 ID + WIF) 및 로컬 개발(클라이언트 시크릿) 토큰 흐름 |
| references/known-limitations.md | 카테고리별로 정리된 29개의 알려진 문제 (공식 프리뷰 알려진 문제 페이지에서 발췌) |
| references/sdk-sidecar.md | AgentID용 Microsoft Entra SDK — 엔드포인트, 타사 에이전트 패턴, Docker/K8s 배포, 보안 |
외부 링크
| 리소스 | URL |
|---|---|
| 공식 설정 가이드 | https://learn.microsoft.com/en-us/entra/agent-id/identity-platform/agent-id-setup-instructions |
| AI 기반 설정 | https://learn.microsoft.com/en-us/entra/agent-id/identity-platform/agent-id-ai-guided-setup |
| AgentID용 Microsoft Entra SDK — 개요 | https://learn.microsoft.com/en-us/entra/msidweb/agent-id-sdk/overview |
| AgentID용 Microsoft Entra SDK — 엔드포인트 | https://learn.microsoft.com/en-us/entra/msidweb/agent-id-sdk/endpoints |
---
name: entra-agent-id
description: Create and manage OAuth2-capable identities for AI agents using Microsoft Graph beta API.
---
# Microsoft Entra Agent ID
Create and manage OAuth2-capable identities for AI agents using Microsoft Graph beta API.
> **Preview API** — All Agent Identity endpoints are under `/beta` only. Not available in `/v1.0`.
## Before You Start
Search `microsoft-docs` MCP for the latest Agent ID documentation:
- Query: "Microsoft Entra agent identity setup"
- Verify: API parameters match current preview behavior
## Conceptual Model
```
Agent Identity Blueprint (application) ← one per agent type/project
└── BlueprintPrincipal (service principal) ← MUST be created explicitly
├── Agent Identity (SP): agent-1 ← one per agent instance
├── Agent Identity (SP): agent-2
└── Agent Identity (SP): agent-3
```
## Prerequisites
### PowerShell (recommended for interactive setup)
```powershell
# Requires PowerShell 7+
Install-Module Microsoft.Graph.Beta.Applications -Scope CurrentUser -Force
```
### Python (for programmatic provisioning)
```bash
pip install azure-identity requests
```
### Required Entra Roles
One of: **Agent Identity Developer**, **Agent Identity Administrator**, or **Application Administrator**.
## Environment Variables
```bash
AZURE_TENANT_ID=<your-tenant-id>
AZURE_CLIENT_ID=<app-registration-client-id>
AZURE_CLIENT_SECRET=<app-registration-secret>
```
## Authentication
> **⚠️ `DefaultAzureCredential` is NOT supported.** Azure CLI tokens contain
> `Directory.AccessAsUser.All`, which Agent Identity APIs explicitly reject (403).
> You MUST use a dedicated app registration with `client_credentials` flow or
> connect via `Connect-MgGraph` with explicit delegated scopes.
### PowerShell (delegated permissions)
```powershell
Connect-MgGraph -Scopes @(
"AgentIdentityBlueprint.Create",
"AgentIdentityBlueprint.ReadWrite.All",
"AgentIdentityBlueprintPrincipal.Create",
"User.Read"
)
Set-MgRequestContext -ApiVersion beta
$currentUser = (Get-MgContext).Account
$userId = (Get-MgUser -UserId $currentUser).Id
```
### Python (application permissions)
```python
import os
import requests
from azure.identity import ClientSecretCredential
credential = ClientSecretCredential(
tenant_id=os.environ["AZURE_TENANT_ID"],
client_id=os.environ["AZURE_CLIENT_ID"],
client_secret=os.environ["AZURE_CLIENT_SECRET"],
)
token = credential.get_token("https://graph.microsoft.com/.default")
GRAPH = "https://graph.microsoft.com/beta"
headers = {
"Authorization": f"Bearer {token.token}",
"Content-Type": "application/json",
"OData-Version": "4.0", # Required for all Agent Identity API calls
}
```
## Core Workflow
### Step 1: Create Agent Identity Blueprint
Sponsors are required and **must be User objects** — ServicePrincipals and Groups are rejected.
```python
import subprocess
# Get sponsor user ID (client_credentials has no user context, so use az CLI)
result = subprocess.run(
["az", "ad", "signed-in-user", "show", "--query", "id", "-o", "tsv"],
capture_output=True, text=True, check=True,
)
user_id = result.stdout.strip()
blueprint_body = {
"@odata.type": "Microsoft.Graph.AgentIdentityBlueprint",
"displayName": "My Agent Blueprint",
"[email protected]": [
f"https://graph.microsoft.com/beta/users/{user_id}"
],
}
resp = requests.post(f"{GRAPH}/applications", headers=headers, json=blueprint_body)
resp.raise_for_status()
blueprint = resp.json()
app_id = blueprint["appId"]
blueprint_obj_id = blueprint["id"]
```
### Step 2: Create BlueprintPrincipal
> **This step is mandatory.** Creating a Blueprint does NOT auto-create its
> service principal. Without this, Agent Identity creation fails with:
> `400: The Agent Blueprint Principal for the Agent Blueprint does not exist.`
```python
sp_body = {
"@odata.type": "Microsoft.Graph.AgentIdentityBlueprintPrincipal",
"appId": app_id,
}
resp = requests.post(f"{GRAPH}/servicePrincipals", headers=headers, json=sp_body)
resp.raise_for_status()
```
If implementing idempotent scripts, check for and create the BlueprintPrincipal
even when the Blueprint already exists (a previous run may have created the Blueprint
but crashed before creating the SP).
### Step 3: Create Agent Identities
```python
agent_body = {
"@odata.type": "Microsoft.Graph.AgentIdentity",
"displayName": "my-agent-instance-1",
"agentIdentityBlueprintId": app_id,
"[email protected]": [
f"https://graph.microsoft.com/beta/users/{user_id}"
],
}
resp = requests.post(f"{GRAPH}/servicePrincipals", headers=headers, json=agent_body)
resp.raise_for_status()
agent = resp.json()
```
## API Reference
| Operation | Method | Endpoint | OData Type |
|-----------|--------|----------|------------|
| Create Blueprint | `POST` | `/applications` | `Microsoft.Graph.AgentIdentityBlueprint` |
| Create BlueprintPrincipal | `POST` | `/servicePrincipals` | `Microsoft.Graph.AgentIdentityBlueprintPrincipal` |
| Create Agent Identity | `POST` | `/servicePrincipals` | `Microsoft.Graph.AgentIdentity` |
| List Agent Identities | `GET` | `/servicePrincipals?$filter=...` | — |
| Delete Agent Identity | `DELETE` | `/servicePrincipals/{id}` | — |
| Delete Blueprint | `DELETE` | `/applications/{id}` | — |
All endpoints use base URL: `https://graph.microsoft.com/beta`
## Required Permissions
| Permission | Purpose |
|-----------|---------|
| `Application.ReadWrite.All` | Blueprint CRUD (application objects) |
| `AgentIdentityBlueprint.Create` | Create new Blueprints |
| `AgentIdentityBlueprint.ReadWrite.All` | Read/update Blueprints |
| `AgentIdentityBlueprintPrincipal.Create` | Create BlueprintPrincipals |
| `AgentIdentity.Create.All` | Create Agent Identities |
| `AgentIdentity.ReadWrite.All` | Read/update Agent Identities |
There are **18 Agent Identity-specific** Graph application permissions. Discover all:
```bash
az ad sp show --id 00000003-0000-0000-c000-000000000000 \
--query "appRoles[?contains(value, 'AgentIdentity')].{id:id, value:value}" -o json
```
Grant admin consent (required for application permissions):
```bash
az ad app permission admin-consent --id <client-id>
```
> Admin consent may fail with 404 if the service principal hasn't replicated. Retry with 10–40s backoff.
## Cleanup
```python
# Delete Agent Identity
requests.delete(f"{GRAPH}/servicePrincipals/{agent['id']}", headers=headers)
# Delete BlueprintPrincipal (get SP ID first)
sps = requests.get(
f"{GRAPH}/servicePrincipals?$filter=appId eq '{app_id}'",
headers=headers,
).json()
for sp in sps.get("value", []):
requests.delete(f"{GRAPH}/servicePrincipals/{sp['id']}", headers=headers)
# Delete Blueprint
requests.delete(f"{GRAPH}/applications/{blueprint_obj_id}", headers=headers)
```
## Best Practices
1. **Always create BlueprintPrincipal after Blueprint** — not auto-created; implement idempotent checks on both
2. **Use User objects as sponsors** — ServicePrincipals and Groups are rejected
3. **Handle permission propagation delays** — after admin consent, wait 30–120s; retry with backoff on 403
4. **Include `OData-Version: 4.0` header** on every Graph request
5. **Use Workload Identity Federation for production auth** — for local dev, use a client secret on the Blueprint (see [references/oauth2-token-flow.md](references/oauth2-token-flow.md))
6. **Set `identifierUris` on Blueprint** before using OAuth2 scoping (`api://{app-id}`)
7. **Never use Azure CLI tokens** for API calls — they contain `Directory.AccessAsUser.All` which is hard-rejected
8. **Check for existing resources** before creating — implement idempotent provisioning
## References
| File | Contents |
|------|----------|
| [references/oauth2-token-flow.md](references/oauth2-token-flow.md) | Production (Managed Identity + WIF) and local dev (client secret) token flows |
| [references/known-limitations.md](references/known-limitations.md) | 29 known issues organized by category (from official preview known-issues page) |
| [references/sdk-sidecar.md](references/sdk-sidecar.md) | Microsoft Entra SDK for AgentID — endpoints, 3P agent patterns, Docker/K8s deployment, security |
### External Links
| Resource | URL |
|----------|-----|
| Official Setup Guide | https://learn.microsoft.com/en-us/entra/agent-id/identity-platform/agent-id-setup-instructions |
| AI-Guided Setup | https://learn.microsoft.com/en-us/entra/agent-id/identity-platform/agent-id-ai-guided-setup |
| Microsoft Entra SDK for AgentID — Overview | https://learn.microsoft.com/en-us/entra/msidweb/agent-id-sdk/overview |
| Microsoft Entra SDK for AgentID — Endpoints | https://learn.microsoft.com/en-us/entra/msidweb/agent-id-sdk/endpoints |
모든 파일
0개 파일entra-agent-id 설치
스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.
ZIP 다운로드저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.
git clone https://github.com/microsoft/skills/tree/main/.github/skills/entra-agent-id # Copy SKILL.md to your .claude/skills/ directory
복사





집
