Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databricks cli api command is not able to "configure default credentials" #1710

Open
AHJiapengZhang opened this issue Aug 22, 2024 · 5 comments
Assignees
Labels
CLI CLI related issues Response Requested

Comments

@AHJiapengZhang
Copy link

Describe the issue

I have my profile configured at ~/.databrickscfg and it works well on databricks bundle but not api.

My ~/.databrickscfg looks like this:

[DEFAULT]

[project-prd]
host = https://adb-.1.azuredatabricks.net
token = 

[project-preprd-acc]
host = https://adb-.1.azuredatabricks.net
token = xxx

[project-nonprd]
host = https://adb-.1.azuredatabricks.net
token = xxx

Steps to reproduce the behavior

Please list the steps required to reproduce the issue, for example:
1.Run databricks api get /api/2.0/clusters/list
2. Error: default 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

Expected Behavior

Clear and concise description of what should have happened

Actual Behavior

Clear and concise description of what actually happened

OS and CLI version

MacOS
Databricks cli version 0.215.0

Is this a regression?

Did this work in a previous version of the CLI? If so, which versions did you try?

Debug Logs

15:04:08 INFO start pid=37071 version=0.215.0 args="databricks, api, get, /api/2.0/clusters/list, --debug"
15:04:08 DEBUG /Users/xxx/.databrickscfg has no DEFAULT profile configured pid=37071 sdk=true
15:04:08 DEBUG failed during request visitor: default 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 pid=37071 sdk=true
Error: default 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
15:04:08 ERROR failed execution pid=37071 exit_code=1 error="default 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"

@AHJiapengZhang AHJiapengZhang added the CLI CLI related issues label Aug 22, 2024
@andrewnester
Copy link
Contributor

@AHJiapengZhang are the hosts for all these profiles are the same? if not, which one do you have configured in bundles? Also, please try to use the latest CLI version (0.227.0) and run databricks auth describe command to help troubleshoot what is the error

@AHJiapengZhang
Copy link
Author

AHJiapengZhang commented Aug 23, 2024

@AHJiapengZhang are the hosts for all these profiles are the same? if not, which one do you have configured in bundles? Also, please try to use the latest CLI version (0.227.0) and run databricks auth describe command to help troubleshoot what is the error

@andrewnester
Hosts are different but I renamed them that way here. I upgraded to 0.227 and get this for databricks auth describe:

Unable to authenticate: please specify target
-----
Current configuration:

If I move out of the current folder(it contains serveral databricks bundle yamls), I will get :

Workspace profiles defined in ~/.databrickscfg
  project-prd (https://adb-1xxx.1.azuredatabricks.net)
  project-preprd
  project-preprd-acc
  project-nonprd

and the result for : databricks api get /api/2.0/clusters/list is:

Error: failed during request visitor: default 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

@andrewnester
Copy link
Contributor

So the first error relates to this issue and we're working on it #1358

The last one seems to be related to the different way we handle auth for API command group.

Just to confirm, does databricks current-user me works correctly for you?

@andrewnester andrewnester self-assigned this Aug 23, 2024
@AHJiapengZhang
Copy link
Author

databricks current-user me

@andrewnester Same as databricks auth describe if it's inside project folder it will say please specify target if outside of folder it display the same workspace profiles to choose from

@andrewnester
Copy link
Contributor

@AHJiapengZhang you have to choose a profile to use because there is no default profile configured in your databricks config. You then can use the same profile in your api commands by providing -p flag and profile name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI CLI related issues Response Requested
Projects
None yet
Development

No branches or pull requests

2 participants