cancel
Showing results for 
Search instead for 
Did you mean: 
Data Governance
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!

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.