# Gets the token
token=$(curl -d "grant_type=client_credentials&client_id=$appId&client_secret=$clientSecret&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default" \
-H "Content-Type: application/x-www-form-urlencoded" -X POST "https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token" | \
jq -r '.access_token')
# This works: Returns all servicePrincipals
curl -H "authorization: bearer $token" -X GET "https://graph.microsoft.com/beta/servicePrincipal"
# This works: one service principal
curl -H "authorization: bearer $token" -X GET "https://graph.microsoft.com/beta/servicePrincipals/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
$ This fails: UnknownError - 500 Internal Server Error
curl -H "authorization: bearer $token" -X GET "https://graph.microsoft.com/beta/servicePrincipals/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/synchronization/jobs"
ERROR:
< HTTP/1.1 500 Internal Server Error
< Cache-Control: private
< Content-Type: application/json
< request-id: xxx
< client-request-id: xxx
< x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"South Central US","Slice":"SliceC","Ring":"X","ScaleUnit":"XXX","RoleInstance":"AGSFE_IN_XX"}}
< Strict-Transport-Security: max-age=31536000
< Date: Tue, 28 Apr 2020 21:52:09 GMT
< Content-Length: 198
<
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "xxxx",
"date": "2020-04-28T21:52:09"
}
}
* Connection #0 to host graph.microsoft.com left intact
}* Closing connection 0
Любое предложение о том, как заставить это работать?
Я проверил эти работы на веб-сайте графического обозревателя с моими учетными данными.
Это использование участника службы, который имеет глобальный права администратора.