gpt4 book ai didi

azure - Microsoft Graph API 中的一个或多个属性包含无效值

转载 作者:行者123 更新时间:2023-12-01 00:20:21 24 4
gpt4 key购买 nike

我想在 Azure Active Directory B2C 上创建用户,我按照给定链接 Here 中的每个步骤进行操作。

网址:- https://graph.windows.net/testinggmail.onmicrosoft.com/users?api-version=1.6

类型:- POST

标题:-

 Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IlNTUWRoSTFjS3ZoUUVEU0p4RTJnR1lzNDBRMCIsImtpZCI6IlNTUWRoSTFjS3ZoUUVEU0p4RTJI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0LzBkZjk3YTliLTQ3MDAtNDY5NS05ZjUyLWNkYzJiYzljMTk2Ny8iLCJpYXQiOjE1MjA4Mzg4OTAsIm5iZiI6MTUyMDgzODg5MCwiZXhwIjoxNTIwODQyNzkwLCJhaW8iOiJZMk5nWU9pNFg3NXh3NGJGcTNYMnFaMmVkZW44T1FBPSIsImFwcGlkIjoiYjc2MDFmOTktYjFiZS00YWQ0LTljMmMtYTVlNzBiYmZkNWNhIiwiYXBwaWRhY3IiOiIxIiwiZV9leHAiOjI2MjgwMCwiaWRwIjoiaHR0cHM6Ly9zdHMud2luZG93cy5uZXQvMGRmOTdhOWItNDcwMC00Njk1LTlmNTItY2RjMmJjOWMxOTY3LyIsIm9pZCI6IjhlNTQwMmViLTRkNTMtNDc5Ny1iOWRjLWFlOGJmMzRmMTE4MCIsInJvbGVzIjpbIkRldmljZS5SZWFkV3JpdGUuQWxsIiwiRGlyZWN0b3J5LlJlYWQuQWxsIiwiTWVtYmVyLlJlYWQuSGlkZGVuIiwiRGlyZWN0b3J5LlJlYWRXcml0ZS5BbGwiLCJEb21haW4uUmVhZFdyaXRlLkFsbCIsIkFwcGxpY2F0aW9uLlJlYWRXcml0ZS5Pd25lZEJ5IiwiQXBwbGljYXRpb24uUmVhZFdyaXRlLkFsbCJdLCJzdWIiOiI4ZTU0MDJlYi00ZDUzLTQ3OTctYjlkYy1hZThiZjM0ZjExODAiLCJ0ZW5hbnRfcmVnaW9uX3Njb3BlIjoiQVMiLCJ0aWQiOiIwZGY5N2E5Yi00NzAwLTQ2OTUtOWY1Mi1jZGMyYmM5YzE5NjciLCJ1dGkiOiJTYVU5Y3psb3kweW51NnNueUhVUkFBIiwidmVyIjoiMS4wIn0.YQf6dWra1jua8XMHdqqqd5vrpVUxil_6YMM00drLl9LmOchUY7AtPOXF6T_p7Bmf2BwOWL02bsm7VJCM5cx_TD0cMzbOr4uybmyJJvDqfi1whvgOWbDnY_J9ArJWQMuk7jPIBPS_WT8UYsmM_ivRmcQcRxZtcYCrAaWWOJFeWFVucJFz9G-ld0qi4TU10-Qk9_owREDoitlwYEZwEzSUU-HauDCkjNVzDNhefXrjlJHMzXcsJMnVyX7txkZpiqcsM8H-2EKbFmavT4fN05zUh1Hy6hSLnKv24uDyB3hf2qEZvOaygDUPFRcbFSWH39yp698FGh9Ayr8vHr9wLRHHdA
Content-Type:application/json

请求正文:-

 { 

"accountEnabled": true,
"signInNames": [
{
"type": "emailAddress",
"value": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7f15101a1c10110c0a121a0d3f18121e1613511c1012" rel="noreferrer noopener nofollow">[email protected]</a>"
}
],
"creationType": "LocalAccount",
"displayName": "Joe Consumer",
"mailNickname": "joec",
"passwordProfile": {
"password": "P@ssword!",
"forceChangePasswordNextLogin": false
},
"passwordPolicies": "DisablePasswordExpiration"
}

回应:-

{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "One or more properties contains invalid values."
},
"date": "2018-03-12T07:24:13",
"requestId": "fef2037f-8c6f-4190-8c5a-727dcccde5eb",
"values": null
}
}'

一些API工作正常,例如GetUsersTokenAcuire,但不能创建用户,我已经用谷歌搜索了它也有很多解决方案,但没有用对我来说链接在这里还有什么我已经尝试过Here如果我按照创建单独的 Direcotry 的步骤操作,则会出现错误,权限不足,无法完成操作。

最佳答案

这种使用 Azure AD Graph API 创建用户的类型适用于 Azure AD B2C:

Beginning with version 1.6, Graph API supports creating local and social account users for Azure Active Directory B2C tenants.

如果您尝试对普通 Azure AD 租户使用此 Azure AD Graph API 请求,它将收到与您的错误消息相同的错误消息。

因此,请确保您要查询的租户是 B2C 租户:

尝试使用 B2C 租户的全局管理员(例如 [email protected] )来获取 token 。然后使用head中的token来使用API​​:

请求:

 POST https://graph.windows.net/myorganization/users?api-version=1.6

正文内容类型:application/json:

{ 

"accountEnabled": true,
"signInNames": [
{
"type": "emailAddress",
"value": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a0cacfc5c3cfced3d5cdc5d2e0c7cdc1c9cc8ec3cfcd" rel="noreferrer noopener nofollow">[email protected]</a>"
}
],
"creationType": "LocalAccount",
"displayName": "Joe Consumer",
"mailNickname": "joec",
"passwordProfile": {
"password": "P@ssword!",
"forceChangePasswordNextLogin": false
},
"passwordPolicies": "DisablePasswordExpiration"
}

希望这有帮助!

关于azure - Microsoft Graph API 中的一个或多个属性包含无效值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49230502/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com