在新环境中移动Azure AD B2C自定义用户属性 [英] Moving Azure AD B2C custom user attributes across new environments
问题描述
我已经在开发AD B2C租户中创建了一个"customerId"用户属性.通过图形API查询这些信息时,我现在得到以下信息;
I've created a 'customerId' user attributes in my development AD B2C tenant. When querying these via the graph API I now get the following;
"extension_b0ba955412524ac8be63e24fa7eb0c23_customerId": "2"
完美!我使用JSON.Net将其转换为强类型对象,因此我的POCO具有以下属性.
Perfect! I use JSON.Net to convert this to a strongly typed object, and hence my POCO has the following property.
public string extension_b0ba955412524ac8be63e24fa7eb0c23_customerId { get; set; }
不太好,但是我可以忍受.我担心的是,当我在暂存和生产环境中创建这些属性时,属性名称将更改,并且我将不得不重写大量代码.如何将这些用户属性迁移到我们的其他环境,以确保属性名称不变?
Not great, but I can live with it. My concern is that when I create these properties in our staging and production environments, the attribute names will change and I will have to rewrite a lot of code. How do I migrate these user attributes to our other environments, ensuring the property names do not change?
推荐答案
Azure AD B2C中的自定义用户属性将始终具有每个Azure AD B2C租户唯一名称的向导.
此向导是"b2c-extensions-app"的应用程序ID,对于租户内的所有自定义属性都相同,但跨租户则不同.
This guid is the Application ID of the 'b2c-extensions-app' and will be the same for all custom attributes within a tenant, but different across tenants.
鉴于此行为,您可以使用以下模式使处理自定义用户属性的代码动态化,以便派生全名* :
extension_<appId>_<attributeName>
并通过图形获取appID:
And obtain the appID via the Graph:
https://graph.windows.net/yourtenant.onmicrosoft.com/applications?$filter=displayName eq 'b2c-extensions-app'
当然,您随时可以在 Azure AD B2C反馈论坛.
这篇关于在新环境中移动Azure AD B2C自定义用户属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!