cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Account SCIM API OpenAPI specification issues

iwan_aucamp
New Contributor III

I'm trying to get a list of all users, groups and service principals on Azure from a python script. As I understand things I should be using the Account SCIM API for this. According to the azure documentation [ref], the OpenAPI specification for this is here, however, this OpenAPI spec seems to have multiple issues, for one it uses `type: uuid`, and when I try and use it with openapi-python-client I get a whole host of errors (see here).

The OpenAPI spec also has `DEPRECATED in favor of http://go/openapi/spec` at the top, which is a bit confusing and not very helpful.

Is this the right OpenAPI specification to use? If not where can I get the right one? And if it is, how can I report these issues with the OpenAPI spec?

2 REPLIES 2

Anonymous
Not applicable

@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

Anonymous
Not applicable

Hi @Iwan Aucamp​ 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.