We would like to connect azure DB from azure databricks notebook, can you please someone help us to provide samples, I saw many of the answer and story but not clear about for me below two points.
what is the service principle id and secrete, where should I get it and if we have AD access, what should I keep inform to my admin to enable for this.
where we can get it the above two point in azure portal.
below stack overflow reference does not have any answer.
as per above link, below code available, how to use it with secrete credentials .
Note : my requirement is azure databricks, we have new job cluster, it is not a fulltime job cluster. we have to use when we required, our job cluster will be start and stop.
Thanks to @The data swamp. for the excellent documentation
The below approach will help you connect to Azure SQL database.
Step 1
You will need to install the SQL Spark Connector and the Microsoft Azure Active Directory Authentication Library for Python.
In your databricks cluster install
com.microsoft.azure:spark-mssql-connector_2.12_3.0:1.0.0-alphafrom Maven andadalfrom PyPI.In the key vault, generate secrets that represent the values from the app registration.
The
Client IdandClient SecretCreate a secret scope to your Key Vault for your client Id, secret, and tenant Id will be generated.
Learn More how to create Secretscope in databricks
Step 2
Create user (
SPN) in the database and then grant permissions on the objects.Table:
Step 3 - connecting to Azure SQL database
Retrieving service principal, secret, and tenant id from Key Vault. The database URL, database, and table