Share via

Establisg connection to sql server using object id of managed identity

Jeevan Kande 26 Reputation points
2022-06-29T10:03:42.17+00:00

HI,
please can some one guide me how to Establish Connection to SQL server using manage identity in data bricks using manage identity object id

I am using following code
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)
and I am getting DefaultAzureCredential failed to retrieve a token from the included credentials

Azure Databricks
Azure Databricks

An Apache Spark-based analytics platform optimized for Azure.

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments

1 answer

Sort by: Most helpful
  1. Ronen Ariely 15,221 Reputation points
    2022-06-29T11:39:34.03+00:00

    Hi @Jeevan Kande

    Welcome to the QnA forums

    Please check the following tutorial which provide a great explanation step-by-step

    https://hevodata.com/learn/databricks-connect-to-sql-server/

    You can also go over this Microsoft doc on using JDBC

    https://learn.microsoft.com/en-us/azure/databricks/data/data-sources/sql-databases?WT.mc_id=DP-MVP-5001699

    I assume that you will not have any question after you read it and try it but of you do, then feel free to come back and elaborate what you need

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.