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

Login loop when using databricks account with azure service principle #726

Closed
BramWeterings opened this issue Sep 1, 2023 · 3 comments · Fixed by #727
Closed

Login loop when using databricks account with azure service principle #726

BramWeterings opened this issue Sep 1, 2023 · 3 comments · Fixed by #727
Assignees
Labels
Bug Something isn't working CLI CLI related issues

Comments

@BramWeterings
Copy link

BramWeterings commented Sep 1, 2023

I'm trying to connect a workspace to a metastore. Connecting on the account level does not seem to work:

Profile is configured as

[DEFAULT]
host                = accounts.azuredatabricks.net
account_id          = <account_id>
azure_tenant_id     = <tenantid>
azure_client_id     = <clientid>
azure_client_secret = <secret>

When i run the command databricks account metastore-assignments create $WorkspaceID $MetastoreID
nothing is returned, it just waits.
when i run it with --debug-level trace it seems to be stuck in a loop

......
{"time":"2023-09-01T12:45:59.362280164Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.362307263Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.362340763Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.362383263Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.362413363Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.362456063Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.362499963Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.362527463Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.362567663Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.362611663Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.362638863Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.362678863Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.362723263Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.362751163Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.362795063Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.362857262Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.362893862Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.362946262Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.363001762Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.363035462Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.363088962Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.363324362Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.363369462Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.363431961Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.363721061Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.363756061Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.363802261Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.363887661Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.363915861Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.36395766Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.36404006Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.36406816Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.36416916Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.36419186Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.36421786Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.36425916Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.36430886Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.36435196Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.36441826Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.36446396Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.364491459Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.364525659Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.364606259Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.364665359Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.364706359Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.364751959Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.364779559Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.364821059Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.364871359Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.364937059Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.364978259Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}
{"time":"2023-09-01T12:45:59.365022759Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via environment","sdk":true}
{"time":"2023-09-01T12:45:59.365065958Z","level":"TRACE","source":"config.go 193}","msg":"Loading config via config-file","sdk":true}
{"time":"2023-09-01T12:45:59.365127258Z","level":"DEBUG","source":"config_file.go 96}","msg":"Loading DEFAULT profile from /root/.databrickscfg","sdk":true}

Loging in with the used credentials works fine, i validated that the SP has the admin role on account level
running databricks cli version v0.203.3

@pietern
Copy link
Contributor

pietern commented Sep 4, 2023

Thanks for reporting. We'll investigate and post back here.

@pietern
Copy link
Contributor

pietern commented Sep 4, 2023

There's a couple of underlying issues to be addressed, but you can unblock yourself by adding https:// to the host field.

@pietern pietern self-assigned this Sep 4, 2023
@pietern pietern added Bug Something isn't working CLI CLI related issues labels Sep 4, 2023
@pietern pietern linked a pull request Sep 11, 2023 that will close this issue
github-merge-queue bot pushed a commit that referenced this issue Sep 11, 2023
## Changes

The previous implementation ran the risk of infinite looping for the
account client due to a mismatch in determining what constitutes an
account client between the CLI and SDK (see
[here](https://github.com/databricks/cli/blob/83443bae8d8ad4df3758f4192c6bbe613faae9c4/libs/databrickscfg/profiles.go#L61)
and
[here](https://github.com/databricks/databricks-sdk-go/blob/0fdc5165e57a4e7af6ec97b47595c6dddf37b10b/config/config.go#L160)).

Ultimately, this code must never infinite loop. If a user is prompted
and selects a profile that cannot be used, they should receive that
feedback immediately and try again, instead of being prompted again.

Related to #726.

## Tests
<!-- How is this tested? -->
@pietern
Copy link
Contributor

pietern commented Sep 11, 2023

@BramWeterings Note that without specifying the https:// prefix you'll still see an error, but no longer an infloop.

Thanks again for reporting this issue!

hectorcast-db pushed a commit that referenced this issue Oct 13, 2023
## Changes

The previous implementation ran the risk of infinite looping for the
account client due to a mismatch in determining what constitutes an
account client between the CLI and SDK (see
[here](https://github.com/databricks/cli/blob/83443bae8d8ad4df3758f4192c6bbe613faae9c4/libs/databrickscfg/profiles.go#L61)
and
[here](https://github.com/databricks/databricks-sdk-go/blob/0fdc5165e57a4e7af6ec97b47595c6dddf37b10b/config/config.go#L160)).

Ultimately, this code must never infinite loop. If a user is prompted
and selects a profile that cannot be used, they should receive that
feedback immediately and try again, instead of being prompted again.

Related to #726.

## Tests
<!-- How is this tested? -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working CLI CLI related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants