我们将Microsoft Azure Active Directory设置为我们的移动应用程序的SSO解决方案,但希望通过服务器端Microsoft Graph API管理用户的帐户创建 .
对于域的内部用户,这非常有效,因为我们使用Graph API作为管理员用户来创建帐户 .
但是,在尝试创建外部帐户时(例如joe.bloggs@gmail.com),这会失败 .
我们正在使用API调用:
POST https://graph.microsoft.com/v1.0/users
身体:
{
"accountEnabled": true,
"mailNickname": "joe.bloggs",
"displayName": "Joe Bloggs",
"givenName": "Joe",
"surname": "Bloggs",
"userPrincipalName": "joe.bloggs@gmail.com",
"passwordProfile" : {
"forceChangePasswordNextSignIn": false,
"password": "somepassword"
}
}
响应:
{
"error": {
"code": "Request_BadRequest",
"message": "Property userPrincipalName is invalid.",
"innerError": {
"request-id": "619450ec-e703-4a12-86e3-8f53c20d55fc",
"date": "2018-01-17T16:30:37"
},
"details": [
{
"target": "userPrincipalName",
"code": "InvalidValue"
}
]
}
}
它说“userPrincipalName”无效,但在查看文档后我不确定API是否支持外部帐户?
注意:我意识到您可以使用“/ beta / invitations”调用,但这不会创建帐户 .
1 回答
我假设您使用Azure AD B2B并希望将新的访客用户添加到您的目录中 .
One thing I want to make clear is that you can invite guest users to your Directory , but you cannot create guest users directly in your Directory.
因此,您可以使用this Microsoft Graph API邀请访客用户:
Request
Response
另外,如果您想邀请没有邀请的访客用户,请参阅this document .
希望这可以帮助!