User/interactive Azure AD authentication

未关闭
#690 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
azure, python, sql

调研方向

该 issue 提到了 dbx_sql.connect、databricks-sdk WorkspaceClient、DefaultAzureCredential 和现有的 Entra ID M2M 方法,但没有 repository 文件或测试。首先定位连接身份验证入口点及其 M2M 实现,然后将其与所示的 az login 和 DefaultAzureCredential 流程进行比较。当受支持的 U2M 工作流能够完成身份验证并运行示例 SQL 查询时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

#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!

主要语言
Python
星标
233
派生
152
平均合并
21 小时 5 分钟
30 天内合并 PR
10

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

databricks/databricks-sql-python 的其他 Issue

查看 databricks/databricks-sql-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。