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!

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!