Skip to content

User/interactive Azure AD authentication #690

Done

Description

@inigohidalgo

#621 by @jprakash-db added a great feature that we will be testing ASAP. Since Entra ID authentication seems to be getting upgraded, I wanted to ask about interactive login.

Using databricks-sdk I can perform this user authentication by doing (from the terminal)

az login --use-device-code
...
User is logged in

then in python

from databricks.sdk import WorkspaceClient

w = WorkspaceClient(host="https://adb-XXXXXX.azuredatabricks.net/")

Would the newly-added Entra ID M2M method be extendable for U2M workflows?

Otherwise, is there an alternative implementation I could use?

This is what I'm currently doing to manually mint a token in the user interactive workflow currently:

from azure.identity import DefaultAzureCredential
from databricks import sql as dbx_sql

_DATABRICKS_SCOPE = "2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default"

DATABRICKS_CLUSTER_HOST = "adb-XXX.azuredatabricks.net"
DATABRICKS_CLUSTER_HTTP_PATH = "/sql/1.0/warehouses/XXX"

cred = DefaultAzureCredential()
token = cred.get_token(_DATABRICKS_SCOPE)

with dbx_sql.connect(
    server_hostname=DATABRICKS_CLUSTER_HOST,
    http_path=DATABRICKS_CLUSTER_HTTP_PATH,
    access_token=token.token,
) as conn, conn.cursor() as c:
        c.execute("SELECT current_user(), current_catalog(), current_schema();")
        print(c.fetchall())

Thanks!

Activity

  1. cathleeny commented on Dec 3, 2026

    @cathleeny
    Collaborator

    For browser-based Entra ID login, use auth_type="azure-oauth" in sql.connect(...):

    connection = sql.connect(
        server_hostname=...,
        http_path=...,
        auth_type="azure-oauth",
    )

    See the Authentication section of the connection parameters reference: https://github.com/databricks/databricks-sql-python/blob/main/CONNECTION_PARAMETERS.md#authentication

    Alternatively, you can pass a custom credentials_provider (for example one from the Databricks SDK) on the default backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions