MS Asure 그래프 API 클라이언트 앱이 ManagedDevices에 대한 데이터를 가져올 수있는 권한을 부여 할 수 없습니다. 극복하는 방법?

그레 기 네이팜

나는, 새로운 응용 프로그램을 등록 복사 한 tenant, client_id그리고 client_secret. 을 사용하여 https://graph.microsoft.com/v1.0액세스 할 수 Bearer있으며 access token-잘 작동합니다. 그러나 나는 다른 것을 얻을 수 없습니다. 이 앱에 범위를 부여하려고했습니다. 운이 없습니다.여기에 이미지 설명 입력

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import pprint
import adal
import requests

pp = pprint.PrettyPrinter(indent=4).pprint

tenant = "<>"
client_id = "<>"
client_secret = "<>"

authority = "https://login.microsoftonline.com/" + tenant
RESOURCE = "https://graph.microsoft.com"

context = adal.AuthenticationContext(authority)

# Use this for Client Credentials
token = context.acquire_token_with_client_credentials(
    RESOURCE,
    client_id,
    client_secret
)

graph_api_endpoint = 'https://graph.microsoft.com/v1.0{0}'
# /me only works with ROPC, for Client Credentials you'll need /<UsersObjectId/
request_url = graph_api_endpoint.format('/Management/managedDevices')
#request_url = graph_api_endpoint.format('/me')
headers = {
'User-Agent' : 'python_tutorial/1.0',
'Authorization' : 'Bearer {0}'.format(token["accessToken"]),
'Accept' : 'application/json',
'Content-Type' : 'application/json'
}

response = requests.get(url = request_url, headers = headers)
pp(response.json())

다음은 API의 HTTP 응답 오류입니다.

{   'error': {   'code': 'UnknownError',
                 'innerError': {   'date': '2020-03-15T06:57:54',
                                   'request-id': 'f011ca02-f8c6-4bcb-90a2-9decbed2cfce'},
                 'message': '{"ErrorCode":"Unauthorized","Message":"{\\r\\n  '
                            '\\"_version\\": 3,\\r\\n  \\"Message\\": \\"An '
                            'error has occurred - Operation ID (for customer '
                            'support): 00000000-0000-0000-0000-000000000000 - '
                            'Activity ID: f011ca02-f8c6-4bcb-90a2-9decbed2cfce '
                            '- Url: '
                            'https://fef.amsua0402.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices?api-version=2018-05-24\\",\\r\\n  '
                            '\\"CustomApiErrorPhrase\\": \\"\\",\\r\\n  '
                            '\\"RetryAfter\\": null,\\r\\n  '
                            '\\"ErrorSourceService\\": \\"\\",\\r\\n  '
                            '\\"HttpHeaders\\": '
                            '\\"{\\\\\\"WWW-Authenticate\\\\\\":\\\\\\"Bearer '
                            'realm=\\\\\\\\\\\\\\"urn:intune:service,c3998d6e-2e37-4c56-87b5-7b444ee1cb26,f0f3c450-59bf-4f0d-b1b2-0ef84ddfe3c7\\\\\\\\\\\\\\"\\\\\\"}\\"\\r\\n}","Target":null,"Details":null,"InnerError":null,"InstanceAnnotations":[]}'}}
토니 주

애플리케이션 권한이있는 액세스 토큰을 요청하는 클라이언트 자격 증명 흐름을 사용하고있었습니다. 그러나 관리 장치 API는 애플리케이션 권한으로 지원되지 않습니다.

여기에 이미지 설명 입력

참고:

위임 된 권한 및 애플리케이션 권한

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

Related 관련 기사

뜨겁다태그

보관