如何使用Azure图形API创建用户 [英] How to create a user using azure graph api
问题描述
我正在尝试使用azure graph
API创建用户.为此,我得到了令牌响应,如下所示:
I am trying to create a user using azure graph
API. For this, I have got the token response as below:
获得令牌后,我将其添加为以下URL中的授权令牌:
Once I have the token, I have added this as bearer token in Authorization for the below url:
https://graph.microsoft.com/v1.0/users
并发布以下json数据:
and posting the below json data:
{
"accountEnabled": true,
"displayName": "Andrew",
"mailNickname": "SanAndrew",
"userPrincipalName": "andrew.san204@gmail.com",
"passwordProfile" : {
"forceChangePasswordNextSignIn": true,
"password": "password"
}
}
但出现以下错误:
{
" error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"request-id": "c06079d2-ff6b-4e5b-b34d-704f16bc312f",
"date": "2019-06-03T11:20:20"
}
}
}
尽管我拥有所有权限,如下所示:
although I have all the permissions as shown below:
有人可以在这里提出我的错吗?
Can anyone please suggest what I am doing wrong here.
推荐答案
出现该错误的一种可能性是,您正在尝试使用gmail.com域创建用户.该域必须是您AAD租户中已验证的域之一.
One possibility for the error is that you are trying to create a user with gmail.com domain. The domain needs to be one of the verified domains in your AAD tenant.
如果仍然要添加gmail.com用户,则需要通过邀请端点发送邀请: https://docs.microsoft.com/zh-cn/graph/api/invitation-post?view=graph-rest -1.0& tabs = cs
If you want to add a gmail.com user anyway, you need to send an invitation through the invitations endpoint: https://docs.microsoft.com/en-us/graph/api/invitation-post?view=graph-rest-1.0&tabs=cs
这篇关于如何使用Azure图形API创建用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!