跳到正文
Skillpedia
自动化40k · #7190

entra-agent-user

它能做什么

这个工具可以在 Microsoft Entra ID 中为 AI 智能体创建用户身份。这样,AI 智能体就能像数字员工一样工作,访问邮件、Teams 等服务。

适用场景

  • ✓AI 智能体需要发送邮件时。
  • ✓AI 智能体需要加入 Teams 会议时。
  • ✓AI 智能体需要访问必须使用用户身份的资源时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/entra-agent-user/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/entra-agent-user/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“为我的营销智能体创建一个 agent user,名称为 'Marketing Agent',UPN 为 'marketing@mycompany.com',并关联到智能体身份 'abc-123'。”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具会利用已有 AI 智能体的身份,在 Microsoft Entra ID 中创建一个新的用户身份。这个新用户身份会获得相应权限,可以像员工一样开展工作。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

SKILL: Creating Agent Users in Microsoft Entra Agent ID

Overview

An agent user is a specialized user identity in Microsoft Entra ID that enables AI agents to act as digital workers. It allows agents to access APIs and services that strictly require user identities (e.g., Exchange mailboxes, Teams, org charts), while maintaining appropriate security boundaries.

Agent users receive tokens with idtyp=user, unlike regular agent identities which receive idtyp=app.


Prerequisites

  • A Microsoft Entra tenant with Agent ID capabilities
  • An agent identity (service principal of type ServiceIdentity) created from an agent identity blueprint
  • One of the following permissions:
    • AgentIdUser.ReadWrite.IdentityParentedBy (least privileged)
    • AgentIdUser.ReadWrite.All
    • User.ReadWrite.All
  • The caller must have at minimum the Agent ID Administrator role (in delegated scenarios)

Important: The identityParentId must reference a true agent identity (created via an agent identity blueprint), NOT a regular application service principal. You can verify by checking that the service principal has @odata.type: #microsoft.graph.agentIdentity and servicePrincipalType: ServiceIdentity.


Architecture

Agent Identity Blueprint (application template)
    │
    ├── Agent Identity (service principal - ServiceIdentity)
    │       │
    │       └── Agent User (user - agentUser) ← 1:1 relationship
    │
    └── Agent Identity Blueprint Principal (service principal in tenant)
Component Type Token Claim Purpose
Agent Identity Service Principal idtyp=app Backend/API operations
Agent User User (agentUser) idtyp=user Act as a digital worker in M365

Step 1: Verify the Agent Identity Exists

Before creating an agent user, confirm the agent identity is a proper agentIdentity type:

GET https://graph.microsoft.com/beta/servicePrincipals/{agent-identity-id}
Authorization: Bearer <token>

Verify the response contains:

{
  "@odata.type": "#microsoft.graph.agentIdentity",
  "servicePrincipalType": "ServiceIdentity",
  "agentIdentityBlueprintId": "<blueprint-id>"
}

PowerShell

Connect-MgGraph -Scopes "Application.Read.All" -TenantId "<tenant>" -UseDeviceCode -NoWelcome
Invoke-MgGraphRequest -Method GET `
  -Uri "https://graph.microsoft.com/beta/servicePrincipals/<agent-identity-id>" | ConvertTo-Json -Depth 3

Common mistake: Using an app registration's appId or a regular application service principal's id will fail. Only agent identities created from blueprints work.


Step 2: Create the Agent User

HTTP Request

POST https://graph.microsoft.com/beta/users/microsoft.graph.agentUser
Content-Type: application/json
Authorization: Bearer <token>

{
  "accountEnabled": true,
  "displayName": "My Agent User",
  "mailNickname": "my-agent-user",
  "userPrincipalName": "my-agent-user@yourtenant.onmicrosoft.com",
  "identityParentId": "<agent-identity-object-id>"
}

Required Properties

Property Type Description
accountEnabled Boolean true to enable the account
displayName String Human-friendly name
mailNickname String Mail alias (no spaces/special chars)
userPrincipalName String UPN — must be unique in the tenant (alias@verified-domain)
identityParentId String Object ID of the parent agent identity

PowerShell

Connect-MgGraph -Scopes "User.ReadWrite.All" -TenantId "<tenant>" -UseDeviceCode -NoWelcome

$body = @{
  accountEnabled    = $true
  displayName       = "My Agent User"
  mailNickname      = "my-agent-user"
  userPrincipalName = "my-agent-user@yourtenant.onmicrosoft.com"
  identityParentId  = "<agent-identity-object-id>"
} | ConvertTo-Json

Invoke-MgGraphRequest -Method POST `
  -Uri "https://graph.microsoft.com/beta/users/microsoft.graph.agentUser" `
  -Body $body -ContentType "application/json" | ConvertTo-Json -Depth 3

Key Notes

  • No password — agent users cannot have passwords. They authenticate via their parent agent identity's credentials.
  • 1:1 relationship — each agent identity can have at most one agent user. Attempting to create a second returns 400 Bad Request.
  • The userPrincipalName must be unique. Don't reuse an existing user's UPN.

Step 3: Assign a Manager (Optional)

…

常见问题

什么是“agent user”?

它是 Microsoft Entra ID 中的一种特殊身份,让 AI 智能体能够以数字员工的身份工作,访问邮件、Teams 等资源。

为什么 AI 智能体需要用户身份?

一些 Microsoft 365 服务访问时需要用户身份,而不仅仅是应用身份。agent user 能帮助 AI 智能体满足这些要求。

agent user 可以设置密码吗?

不可以。agent user 无法设置密码,它们使用父级智能体身份的凭据进行身份验证。

详情

作者的原始描述

Create Agent Users in Microsoft Entra ID from Agent Identities, enabling AI agents to act as digital workers with user identity capabilities in Microsoft 365 and Azure environments.

repo: github/awesome-copilot

热度

GitHub 星标
40k
排名
#7190
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能