@Iwan Aucamp :
The OpenAPI specification you found for the Azure Account SCIM API may not be up-to-date or may have issues as you have encountered. Microsoft provides several APIs for Azure Active Directory that allow programmatic access to users, groups, and service principals. You may want to consider using Microsoft Graph API, which provides a unified programmability model that can be used to access data and insights across the Microsoft Cloud.
To access Azure Active Directory data with Microsoft Graph API, you will need to authenticate using OAuth 2.0. Once authenticated, you can use the Microsoft Graph API endpoints to get users, groups, and service principals. You can also use the Graph Explorer to interactively test and explore the API.
Here is an example of how to list all users in Python using the Microsoft Graph API:
import requests
import json
# Set the API endpoint and headers
url = "https://graph.microsoft.com/v1.0/users"
headers = {
"Authorization": "Bearer <ACCESS_TOKEN>",
"Accept": "application/json"
}
# Make the API request and handle errors
response = requests.get(url, headers=headers)
if response.status_code != 200:
print("Error:", response.status_code, response.text)
exit()
# Parse the response and print the users
users = json.loads(response.text)["value"]
for user in users:
print(user["displayName"], user["userPrincipalName"])
You can find more information and examples for using the Microsoft Graph API in Python in the official documentation: https://docs.microsoft.com/en-us/graph/sdks/sdks-overview