cancel
Showing results for 
Search instead for 
Did you mean: 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results for 
Search instead for 
Did you mean: 

Account client not able to get workspace client

vaishalisai
New Contributor II

So I did U2M authentication for account-level operations -

databricks auth login --host <account-login-url> --account-id <account-id>

then I tried to run code-

workspaces = account_client.workspaces.list()
workspace_obj=account_client.get_workspace_client(workspaces[0])
 
I got error saying - 

ValueError: databricks-cli auth: cannot configure default credentials, please check https://docs.databricks.com/en/dev-tools/auth.html#databricks-client-unified-authentication to configure credentials for your preferred authentication method.

I am not sure what's going wrong here

2 REPLIES 2

Alberto_Umana
Databricks Employee
Databricks Employee

Hi @vaishalisai,

Could you please run below validations?

Run this command to validate: databricks auth describe

Check the Databricks Configuration File: Ensure that your .databrickscfg file is correctly configured. This file should be located in your home directory and should contain the necessary credentials. The file should look something like this: [DEFAULT] host = https://<your-databricks-instance> token = <your-personal-access-token>

 

Verify Environment Variables: Make sure that the environment variables DATABRICKS_HOST and DATABRICKS_TOKEN are set correctly. These variables should point to your Databricks instance and contain your access token, respectively.

 

Unified Authentication: According to the documentation, you should ensure that you have configured the unified authentication method correctly. You can refer to the detailed steps in the Databricks documentation here: Databricks Client Unified Authentication.

 

OAuth for Users (U2M): Since you mentioned using U2M (User-to-Machine) authentication, ensure that you have followed the steps to generate an OAuth code verifier and challenge pair if required. This is necessary for the OAuth authentication process.

vaishalisai
New Contributor II

I am doing using a service principal so my .databrickscfg has -

[databricks-demo]
client_id = -----
client_secret = ----
host = https://accounts.cloud.databricks.com/
account_id = ----
 
 

 

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