我在 Azure Active Directory B2C 租户中添加了一个自定义 Organization
字段作为用户属性,如下所示:
I have added a custom Organization
field as a User Attribute in my Azure Active Directory B2C tenant, like so:
我正在使用 Microsoft Graph .NET 客户端库来管理 Azure 中的用户Active Directory B2C 并希望使用类似于以下代码的内容来设置用户的自定义 Organization
字段和用户的内置 Email Addresses
字段.
I am using the Microsoft Graph .NET Client Library to manage users in Azure Active Directory B2C and would like to use something similar to the following code to set the user's custom Organization
field and the user's built-in Email Addresses
field.
await graphClient.Users[user.Id].Request().UpdateAsync(new User()
{
Email Addresses = new StringCollection("myemail@mydomain.com")
Organization = "Microsoft"
});
两个问题:
电子邮件地址
?Organization
?本文档显示 如何创建自定义属性,但不告诉如何使用图形客户端访问或使用该属性.
This documentation shows how to create a custom attribute but does not tell how to access or use that attribute using the Graph Client.
本文档展示了如何创建自定义属性并编辑依赖方 (RP) 文件.
有没有更简单的方法?然后获取/设置这些自定义用户属性的 graphClient
代码是什么?
Is there an easier way? And what is the graphClient
code to then get/set these custom user attributes?
Microsoft Graph API 以及 Microsoft Graph 客户端是否支持向 Azure AD B2C 租户注册的扩展属性有点令人困惑.
It is a bit confusing about whether the Microsoft Graph API, and hence the Microsoft Graph Client, supports the extension properties that are registered with an Azure AD B2C tenant.
当我使用 Azure AD Graph API 查询用户对象时,会返回自定义属性(例如CreatedTime").
When I query a user object using the Azure AD Graph API, then the custom attributes (e.g. "CreatedTime") are returned.
https://graph.windows.net/{tenant}/users/{objectId}
返回:
{
"odata.metadata": "https://graph.windows.net/{tenant}/$metadata#directoryObjects/Microsoft.DirectoryServices.User/@Element",
"odata.type": "Microsoft.DirectoryServices.User",
"objectType": "User",
...
"extension_917ef9adff534c858b0a683b6e6ec0f3_CreatedTime": 1518602039
}
当我使用 Microsoft Graph API 查询同一个对象时,不会返回自定义属性.
When I query the same object using the Microsoft Graph API, then the custom attributes aren't returned.
https://graph.microsoft.com/v1.0/users/{id}/extensions
返回:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('{id}')/extensions",
"value": []
}
除非您收到更好的答案,否则我建议您使用 Azure AD Graph API,也可以选择 Azure AD Graph 客户端,用于获取和设置 Azure AD B2C 用户的扩展属性.
Unless you receive a better answer, then I suggest you use the Azure AD Graph API, and optionally the Azure AD Graph Client, to get and set the extension properties for the Azure AD B2C users.
获取和设置用户扩展属性的示例可以在 宣布 Azure AD Graph API 客户端库 2.0
Examples of getting and setting the extension properties for users can be found at Announcing Azure AD Graph API Client Library 2.0
这篇关于如何在 ASP.NET MVC 中获取/设置自定义 Azure Active Directory B2C 用户属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!