Azure AD B2C 创建用户时出现图形 API 错误
Azure AD B2C Create User with the Graph API error
我跟随 this guide in order to set up my azure application and this code 在我的 B2C
用户广告中创建了一个用户:我在 .AddAsync(user)
上获得了一个 System.NullReferenceException
。
// Create the user account in the directory
var u = graphClient.Users;
var v = u.Request();
var w = await v.AddAsync(user); // --> NullReferenceException: v is not null
还测试了以下内容:
var user = new User
{
AccountEnabled = true,
DisplayName = "Adele Vance",
MailNickname = "AdeleV",
UserPrincipalName = "AdeleV@contoso.onmicrosoft.com",
PasswordProfile = new PasswordProfile
{
ForceChangePasswordNextSignIn = true,
Password = "xWwvJ]6NMw+bWH-d"
},
};
// Create the user account in the directory
var u = graphClient.Users;
var v = u.Request();
var w = await v.AddAsync(user); //--> same error
问题出在测试版 Nuget 包 Microsoft.Graph.Beta Version="0.12.0-preview"
。我切换到新的 Microsoft.Graph Version="3.27.0" and Microsoft.Graph.Core Version="1.24.0"
并更新了所有其他的。
我开了一个pull request
我跟随 this guide in order to set up my azure application and this code 在我的 B2C
用户广告中创建了一个用户:我在 .AddAsync(user)
上获得了一个 System.NullReferenceException
。
// Create the user account in the directory
var u = graphClient.Users;
var v = u.Request();
var w = await v.AddAsync(user); // --> NullReferenceException: v is not null
还测试了以下内容:
var user = new User
{
AccountEnabled = true,
DisplayName = "Adele Vance",
MailNickname = "AdeleV",
UserPrincipalName = "AdeleV@contoso.onmicrosoft.com",
PasswordProfile = new PasswordProfile
{
ForceChangePasswordNextSignIn = true,
Password = "xWwvJ]6NMw+bWH-d"
},
};
// Create the user account in the directory
var u = graphClient.Users;
var v = u.Request();
var w = await v.AddAsync(user); //--> same error
问题出在测试版 Nuget 包 Microsoft.Graph.Beta Version="0.12.0-preview"
。我切换到新的 Microsoft.Graph Version="3.27.0" and Microsoft.Graph.Core Version="1.24.0"
并更新了所有其他的。
我开了一个pull request