Skip to content

Commit 476af5d

Browse files
authored
Simplify auth login help text, document query parameter support (#4906)
## Why The `auth login` help text was verbose and redundant. Four numbered scenarios all described the same core behavior (profile is created or updated) with minor variations, and each repeated the "databricks-cli" auth type implementation detail. The help text also didn't mention URL query parameter support (`?o=`, `?account_id=`). ## Changes **Before:** ~40 lines of help text with four near-identical scenarios explaining profile update behavior, specific SDK names that will go stale, and no mention of query parameter support. **Now:** ~20 lines. Drops the redundant scenarios in favor of one sentence ("If a profile with the given name already exists, it is updated. Otherwise a new profile is created."). Adds documentation for URL query parameters (`?o=<workspace_id>&account_id=<id>`) with a shell quoting note. Replaces specific SDK list with generic "SDKs". ## Test plan - [x] `make checks` passes - [x] `databricks auth login --help` shows updated text - [x] No functional changes, help text only
1 parent 49cc72b commit 476af5d

1 file changed

Lines changed: 15 additions & 33 deletions

File tree

cmd/auth/login.go

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -97,47 +97,29 @@ func newLoginCommand(authArguments *auth.AuthArguments) *cobra.Command {
9797
Use: "login [HOST]",
9898
Short: "Log into a Databricks workspace or account",
9999
Long: fmt.Sprintf(`Log into a Databricks workspace or account.
100-
This command logs you into the Databricks workspace or account and saves
101-
the authentication configuration in a profile (in %s by default).
102-
103-
This profile can then be used to authenticate other Databricks CLI commands by
104-
specifying the --profile flag. This profile can also be used to authenticate
105-
other Databricks tooling that supports the Databricks Unified Authentication
106-
Specification. This includes the Databricks Go, Python, and Java SDKs. For more information,
107-
you can refer to the documentation linked below.
100+
101+
This command authenticates via OAuth in the browser and saves the result
102+
to a configuration profile (in %s by default). Other Databricks CLI
103+
commands and SDKs can use this profile via the --profile flag. For more
104+
information, see:
108105
AWS: https://docs.databricks.com/dev-tools/auth/index.html
109106
Azure: https://learn.microsoft.com/azure/databricks/dev-tools/auth
110107
GCP: https://docs.gcp.databricks.com/dev-tools/auth/index.html
111108
109+
If no host is provided, the CLI opens login.databricks.com where you can
110+
authenticate and select a workspace.
112111
113-
If no host is provided (via --host, as a positional argument, or from an existing
114-
profile), the CLI will open login.databricks.com where you can authenticate and
115-
select a workspace. The workspace URL will be discovered automatically.
116-
117-
A profile name (using --profile) can be specified. If you don't specify these
118-
values, you'll be prompted for values at runtime.
119-
120-
While this command always logs you into the specified host, the runtime behaviour
121-
depends on the existing profiles you have set in your configuration file
122-
(at %s by default).
123-
124-
1. If a profile with the specified name exists and specifies a host, you'll
125-
be logged into the host specified by the profile. The profile will be updated
126-
to use "databricks-cli" as the auth type if that was not the case before.
112+
The host can be provided as a positional argument, via --host, or from an
113+
existing profile. The host URL may include query parameters to set the
114+
workspace and account ID:
127115
128-
2. If a profile with the specified name exists but does not specify a host,
129-
you'll be prompted to specify a host. The profile will be updated to use the
130-
specified host. The auth type will be updated to "databricks-cli" if that was
131-
not the case before.
116+
databricks auth login --host "https://<host>?o=<workspace_id>&account_id=<id>"
132117
133-
3. If a profile with the specified name exists and specifies a host, but you
134-
specify a different host using --host (or as the [HOST] positional arg), the
135-
command returns an error. Use --profile alone to log in with the profile's
136-
configured host, or omit --profile to log in with the specified host.
118+
Note: URLs containing "?" must be quoted to prevent shell interpretation.
137119
138-
4. If a profile with the specified name does not exist, a new profile will be
139-
created with the specified host. The auth type will be set to "databricks-cli".
140-
`, defaultConfigPath, defaultConfigPath),
120+
If a profile with the given name already exists, it is updated. Otherwise
121+
a new profile is created.
122+
`, defaultConfigPath),
141123
}
142124

143125
var loginTimeout time.Duration

0 commit comments

Comments
 (0)