02-08-2023 01:14 AM
Problem
I'm unable to authenticate against the https://accounts.cloud.databricks.com endpoint even though I'm an account admin. I need it to assign account level groups to workspaces via the workspace assignment api (https://api-docs.databricks.com/rest/latest/permission-assignment-account-api.html) which is recommended by Databricks.
Our Databricks instance is deployed to AWS.
What's been tried
Code
def list_account_groups():
"""Note: Requires Account admin PAT token to list all account groups"""
api_version = '/api/2.0'
api_command = "/scim/v2/Groups"
url = f"https://accounts.cloud.databricks.com{api_version}/accounts/{ACCOUNT_ID}{api_command}"
header = {
"accept": "application/scim+json",
"Authorization": f"Bearer {DATABRICKS_TOKEN}"
}
response = requests.get(url, headers=header)
print(response.status_code)
print(json.dumps(json.loads(response.text), indent = 2))
Response:
401
{
"message": "Cannot complete request; user is unauthenticated"
}
04-09-2023 07:49 AM
@lasse l :
It seems like the authentication token you are using is not authorized to access the Account API endpoint. The fact that you are able to authenticate against workspace endpoints using the same token suggests that the issue is specific to the Account API.
Here are a few steps you can try to troubleshoot the issue:
Hope this helps!
09-04-2023 08:56 AM
"Check that the token has the "Manage" permission for the "Account Management API"
Can you elaborate how to do the above from the workspace UI?
04-10-2023 03:14 AM
Hi @lasse l
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!
07-12-2024 03:03 PM
From this doc: To automate Databricks account-level functionality, you cannot use Databricks personal access tokens. Instead, you must use either OAuth tokens for Databricks account admin users or service principals. For more information, see:
Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!
Sign Up Now