cancel
Showing results for 
Search instead for 
Did you mean: 
Data Governance
Join discussions on data governance practices, compliance, and security within the Databricks Community. Exchange strategies and insights to ensure data integrity and regulatory compliance.
cancel
Showing results for 
Search instead for 
Did you mean: 

API to get all metastores on the account

iwan_aucamp
New Contributor III

The Unity Catalog API 2.1 only supports retrieving the unity catalogs associated with individual workspaces

> The listMetastores endpoint does not list all Metstores that exist in the customer account. Instead it restricts the list by what the Workspace (as determined by the client’s PAT token) can access.

I have checked what happens in the WebUI when I access https://accounts.azuredatabricks.net/data - and it does a GET on https://accounts.azuredatabricks.net/api/2.0/accounts/${DATABRICKS_ACCOUNT_ID}/metastores

I tried calling this using an AzureAD access token, but this is not working, I keep getting a 303 with location: https://accounts.azuredatabricks.net/login?next_url=%2Fapi%2F2.0%2Faccounts%2F...%2Fmetastores - using the exact same access token with GET on https://accounts.azuredatabricks.net/api/2.0/accounts/${DATABRICKS_ACCOUNT_ID}/scim/v2/Users works fine.

Is there some other API that I can use to get all metastores on the account? Or is there some way you can make this API work with access tokens? Would also be nice to have it in some OpenAPI spec.

3 REPLIES 3

Anonymous
Not applicable

@Iwan Aucamp​ 

Based on your description, it seems like you are encountering an authentication issue when trying to call the Unity Catalog API. It is possible that the AzureAD access token you are using does not have the necessary permissions to access the Metastores endpoint.

One potential solution could be to try using a Databricks personal access token (PAT) instead of an AzureAD access token. PATs are specifically designed for accessing Databricks APIs and may have the necessary permissions to access the Metastores endpoint.

A Databricks personal access token is workspace specific as far as I can tell, which is also not ideal, but I will give it a try.

Anonymous
Not applicable

Hi @Iwan Aucamp​ 

Hope everything is going great.

Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you. 

Cheers!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group