fre*_*eek 3 azure azure-ad-b2c microsoft-graph-sdks microsoft-graph-api
我想通过 graph api 或 sdk 为整个 b2c 实例创建“用户自定义属性”。就像我按照下面引用的 ms文档通过 Azure 门户所做的那样。
1. Sign in to the Azure portal as the global administrator of your Azure AD B2C tenant.
2. Make sure you're using the directory that contains your Azure AD B2C tenant by switching to it in the top-right corner of the Azure portal.
3. Select your subscription information, and then select Switch Directory.
4. Choose All services in the top-left corner of the Azure portal, search for and select Azure AD B2C.
5. Select User attributes, and then select Add.
6. Provide a Name for the custom attribute (for example, "ShoeSize")
7. Choose a Data Type. Only String, Boolean, and Int are available.
8. Optionally, enter a Description for informational purposes.
9. Click Create.
Run Code Online (Sandbox Code Playgroud)
需要明确的是,我不想创建具有自定义属性的用户,而是为 B2C 中的所有用户创建自定义属性。
我可以做吗?如果可以,怎么做?
您可以使用Create extensionProperty为整个 B2C 实例创建“用户自定义属性”。
请注意,我们需要将其指定targetObjects为“用户”。
一个例子:
Post https://graph.microsoft.com/v1.0/applications/{object id of the Azure AD application}/extensionProperties
{"name":"customAttribute","dataType":"string","targetObjects":["User"]}
Run Code Online (Sandbox Code Playgroud)
它将生成一个名为 的扩展属性extension_{client id of the Azure AD application without "-"}_customAttribute。
然后,您可以更新任何 B2C 帐户的扩展属性:
Patch https://graph.microsoft.com/v1.0/users/{user id}
{"extension_{client id of the Azure AD application without "-"}_customAttribute":"value"}
Run Code Online (Sandbox Code Playgroud)
请注意:
您在 Azure 门户上创建的用户自定义属性与名为您可以在Azure AD B2C ->应用程序注册->所有应用程序b2c-extensions-app. Do not modify. Used by AADB2C for storing user data.下找到的Azure AD 应用程序相关联。
但使用 Microsoft Graph 创建的自定义属性不会出现在Azure 门户上 | 用户属性,无论您是在b2c-extensions-appAzure AD 应用程序还是任何其他 Azure AD 应用程序下创建自定义属性。
| 归档时间: |
|
| 查看次数: |
1915 次 |
| 最近记录: |