我使用Microsoft Graph API PHP SDK在Azure Active Directory B2C中添加用户。我设法创建了一个用户userPrincipalName
,如[email protected]
。在Azure AD B2C(gmail等)中为其他邮件提供商创建用户
我无法添加具有GMail地址的用户,例如[email protected]
。
我试图添加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...)
这里是我的JSON请求体:
{
"accountEnabled": true,
"displayName": "John Doe",
"userPrincipalName": "[email protected]",
"creationType": "LocalAccount",
"passwordProfile" : {
"forceChangePasswordNextSignIn": true,
"password": "[email protected]!ssWor?D"
},
"signInNames": [
{
"type": "emailAddress",
"value": "[email protected]"
}
]
}
[尚不支持,请参阅此SO帖子,使用AAD图形API](https://stackoverflow.com/questions/43770376/which-graph-api-should-be-used-with-azure-ad-b2c ):'https:// graph.windows.net' – spottedmahn
我认为这个函数是在7月份的1.6版本中添加的。 请参阅https://msdn.microsoft.com/fr-fr/library/azure/ad/graph/api/users-operations(章节“创建用户(本地帐户)”) – Aldwen
我怀疑这适用于AAD而不是B2C – spottedmahn