我有一个程序,我通过微软图形在我的Azure AD b2c中创建用户对于普通用户,代码运行并创建AD b2c帐户
在B2C中,我有管理员用户,它们是租户管理员当我尝试以编程方式创建与b2c用户相同的用户帐户时,我得到错误
Creating new user in Azure AD b2c error: Another object with the same value for property proxyAddresses already exists
但是当我通过GUI执行相同的操作时,我可以添加2个具有相同电子邮件的帐户。第一个是作为admin被邀请的用户,第二个是B2C普通用户
var user = new User
{
AccountEnabled = true,
GivenName = "MJX",
Surname = MJX,
Mail = theEmail,
DisplayName = "Someting",
UserType = "Member",
CreationType = "LocalAccount",
PasswordProfile = new PasswordProfile
{
ForceChangePasswordNextSignIn = true,
Password = GeneratedPassword,
},
PasswordPolicies = "DisablePasswordExpiration",
Identities = new List<ObjectIdentity>
{
new ObjectIdentity()
{
SignInType = "emailAddress",
Issuer = tenantName,
IssuerAssignedId = theEmail
}
}
};
//insert into AD
var createdUser = graphServiceClient.Users
.Request()
.AddAsync(user).GetAwaiter().GetResult();
删除了Mail属性,它为我工作
//Mail = theEmail