A cloud-based identity and access management service for securing user authentication and resource access
The code below works for me to get acces to Intune data via graph in Python
import requests, json
# Authenticate with Azure Management API
az_auth_post_body = { 'grant_type': 'client_credentials',
'client_id': "ADD YOUR CLIENT ID HERE",
'client_secret': "ADD YOUR CLIENT SECRET HERE",
'resource': 'https://graph.microsoft.com',
'scope': 'https://graph.microsoft.com'
}
az_auth_url = f"https://login.microsoftonline.com/<< ADD YOUR TENANT ID HERE >>/oauth2/token"
az_auth_result = requests.post(az_auth_url, data = az_auth_post_body )
az_access_token = json.loads(az_auth_result.content)['access_token']
az_auth_header = { 'Authorization': f"Bearer { az_access_token }"}
managed_device_overview_url = "https://graph.microsoft.com/v1.0/deviceManagement/managedDeviceOverview"
managed_device_overview_result = requests.get(
managed_device_overview_url,
headers = az_auth_header
)
print(managed_device_overview_result.content)