简体   繁体   English

在 Azure AD B2C(gmail 等...)中使用其他邮件提供商创建用户

[英]Create user with other mail provider in Azure AD B2C (gmail,etc...)

I used Microsoft Graph API PHP SDK to add user in my Azure Active Directory B2C.我使用 Microsoft Graph API PHP SDK 在我的 Azure Active Directory B2C 中添加用户。 I managed to create users with a userPrincipalName like name@mytenantid.onmicrosoft.com .我设法使用userPrincipalName创建用户,例如name@mytenantid.onmicrosoft.com

I wasn't able to add users with a GMail address such as john.doe@gmail.com .我无法添加地址为 GMail 的用户,例如john.doe@gmail.com

I tried to add the signInNames collection but I got the following response:我尝试添加signInNames集合,但收到以下响应:

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error:
POST https://graph.microsoft.com/v1.0/users resulted in a 400 Bad Request
response: 
   { "error": { 
       "code": "Request_BadRequest", 
       "message": "Invalid property 'signInNames'.", 
       "innerError": (truncated...)

Here is my JSON request body:这是我的 JSON 请求正文:

{
    "accountEnabled": true,
    "displayName": "John Doe",
    "userPrincipalName": "john@doe.fr",
    "creationType": "LocalAccount",  
    "passwordProfile" : {
        "forceChangePasswordNextSignIn": true,
        "password": "P@!ssWor?D"
    },
    "signInNames": [
        {
            "type": "emailAddress",
            "value": "john@doe.fr"
        }
     ]
}

You're confusing Microsoft Graph API with the Azure AD Graph API . 您将Microsoft Graph APIAzure AD Graph API混淆了。 These are two different APIs. 这是两个不同的API。 While they share a lot of functionality, calls to these APIs are not interchangeable. 尽管它们共享许多功能,但对这些API的调用不可互换。

The User object in Microsoft Graph API doesn't support a signInNames property. Microsoft Graph API中的User对象不支持signInNames属性。 This is why it is returning that error. 这就是为什么它返回该错误的原因。

Local account users are not supported by Microsoft Graph API at the moment. Microsoft Graph API目前不支持本地帐户用户。

In case if someone will still have the same problem, in MS Graph Api you can use "identities" instead of "signInNames" and your JSON will look like如果有人仍然遇到同样的问题,在 MS Graph Api 中你可以使用“identities”而不是“signInNames”,你的 JSON 看起来像

{
   "accountEnabled":true,
   "displayName":"John Doe",
   "userPrincipalName":"john@doe.fr",
   "creationType":"LocalAccount",
   "passwordProfile":{
      "forceChangePasswordNextSignIn":true,
      "password":"P@!ssWor?D"
   },
   "identities":[
      {
         "signInType":"emailAddress",
         "issuer":"<your tenant domain name>",
         "issuerAssignedId":"john@doe.fr"
      }
   ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure B2C - 无法让 B2C 用户流与另一个 Azure AD 实例一起作为自定义身份提供商 - Azure B2C - Can't get a B2C user flow to work with another Azure AD instance as a custom identity provider Azure AD B2C 外部用户登录 - Azure AD B2C External User login 品牌 Azure 广告 B2C 电子邮件 - Brand Azure AD B2C emails azure功能与AD B2C整合 - azure functions and AD B2C integration Azure AD B2C 的响应 URI 返回 404,自定义 OpenID 身份提供者 - Response URI for Azure AD B2C returns 404, custom OpenID identity provider Azure APIM:坚持身份提供商和 AD B2C 自定义域 - Azure APIM : stuck with identity provider and AD B2C custom domain Azure Ad b2c:成功登录azure ad b2c后在Claims中获得email - Azure Ad b2c: Get email in Claims after successfully Signin in azure ad b2c Azure AD B2C - 忘记密码用户之旅 - 不允许使用旧密码? - Azure AD B2C - Forgot Password User Journey - Don't Allow old password? 将社交帐户链接到 Azure AD B2C 上的本地帐户,来自 .net MVC 中经过身份验证的用户 - Linking Social Account into Local Account on Azure AD B2C from authenticated user in .net MVC 如何通过 Microsoft Graph Azure AD B2C 自定义用户属性进行交互 PowerShell SDK? - How to interact with Azure AD B2C custom User Attributes via Microsoft Graph PowerShell SDK?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM