簡體   English   中英

是否可以使用來自數據磚中的 azure 托管標識的對象 id 連接 sql server

[英]is it possible to connect sql server using object id from azure managed identity in data bricks

請有人指導我如何使用管理身份對象ID在數據塊中使用管理身份建立與SQL服務器的連接

我正在使用以下代碼'''

from azure.core.exceptions import ClientAuthenticationError
from azure.identity import DefaultAzureCredential


# Create a secret client using the DefaultAzureCredential
c_id =  DefaultAzureCredential(managed_identity_client_id=client_id)
try:
    #https://database.windows.net/.default
    #bipp-training-server.database.windows.net/.default
    secret = c_id.get_token("https://database.windows.net/.default")
except ClientAuthenticationError as ex:
    print(ex.message)

''' 我得到 DefaultAzureCredential failed to retrieve a token from the included credentials

如果您想將azure managed identity與 azure Databricks 連接

關注@Alex Ott的這個SO線程

示例代碼

from databricks import sql from azure.identity import ClientSecretCredential import os tenant_id = 'enter_tenant_id' client_id = 'enter_client_id' client_secret = os.environ['SP_SECRET'] csc = ClientSecretCredential(tenant_id, client_id, client_secret) scope = '2xxxxx/.default' token = csc.get_token(dbx_scope).token

請參閱此文檔以將 SQL 連接到 azure Databricks

托管標識與虛擬機相關聯,目前 Databricks 不支持 Databricks 集群的托管標識。 所以唯一的選擇是使用Service principal authentcation

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM