【发布时间】:2022-11-30 15:46:25
【问题描述】:
标签: azure azure-active-directory
标签: azure azure-active-directory
我试图在我的环境中重现相同的内容以在 azure AD 中添加自定义扩展属性。
像下面这样创建一个新的应用程序注册
Azure AD 门户>Azure Active Directory>应用程序注册
(https://i.imgur.com/QwylSSx.png)
使用 Graph Explorer 创建自定义扩展属性,并使用全局管理员帐户登录图形资源管理器。
您可以获得如下所示的应用程序对象 ID
Azure 门户>Azure Active Directory>应用程序注册>选择您的应用程序
(https://i.imgur.com/lfTa8m7.png)
在 graph explorer 中执行代码,如下所示
GET https://graph.microsoft.com/v1.0/applications/<AppregistrationObjectID>
修改代码以创建自定义扩展
POST https://graph.microsoft.com/v1.0/applications/<AppregistrationObjectID>/extensionProperties
{
"name": "CustomAttribute",
"dataType": "string",
"targetObjects": [
"User",
"Group"
]
}
(https://i.imgur.com/dYVpC8M.png)
将自定义属性添加到用户对象,如下所示
PATCH https://graph.microsoft.com/v1.0/users/<UserObjectID>
{
"extension_47c8caba8d924ac9a0f159b0dcc8d4c7_CustomAttribute": "Demo"
}
(https://i.imgur.com/kmKPcmg.png)
您可以获得如下所示的用户对象 ID
Azure 门户>Azure Active Directory>用户>选择您的全局管理员用户
(https://i.imgur.com/moB3C2D.png)
在访问令牌中添加自定义属性
(https://i.imgur.com/5BDo5FJ.png)
最后添加了如下自定义扩展属性
【讨论】: