Skip to content

databricks auth token command doesn't support oauth-m2m flow #1939

@zackverham

Description

@zackverham

Note: I'm not sure what the expected behavior for the databricks auth token command is - filing this as a bug report because the context in the bug report template seems useful.

Describe the issue

I'm trying to run the databricks auth token command using a profile which specifies a service principal (with a client_id and client_secret).

When I run databricks auth token --profile <service-principal>, I get back an access token that identifies me rather than the service principal.

Steps to reproduce the behavior

  • Setup a profile in your databrickscfg file which specifies an oauth-m2m flow with a service principal.
  • Use databricks auth describe --profile <service-principal> and databricks auth env --profile <service-principal> to confirm that the profile represents the oauth-m2m auth type
  • Run databricks auth token --profile <service-principal>
  • Observe that the returned access token does not represent the service principal, but represents me, the user.

Expected Behavior

I'd expect the databricks auth token command to return an access token for the service principal.

Actual Behavior

I receive an access token for myself.

OS and CLI version

Please include the version of the CLI (eg: v0.1.2) and the operating system (eg: windows). You can run databricks --version to get the version of your Databricks CLI

Databricks CLI v0.225.0
MacOS

Is this a regression?

I don't believe so, no.

Debug Logs

Output logs if you run the command with debug logs enabled. Example: databricks clusters list --log-level=debug. Redact if needed

10:01:58  INFO start pid=97471 version=0.225.0 args="databricks, auth, token, --debug, --profile, <service-principal>"
<access_token payload>
10:01:58  INFO completed execution pid=97471 exit_code=0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions