Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
w0ns0ng
Microsoft Employee
Microsoft Employee

Connecting to SQL Endpoint from a noteobok using Service Principal?

Anyone had success connecting to SQL endpoint from a notebook using Service Principal? 

 

I get "ActiveDirectoryServicePrincipal" is not valid using JDBC. Tried installing msal4j and mssql conenction jar, but couldnt figure it out.

 

I also tried using ADAL to generate access token instead but not sure what the resource URL would be. Tried various combinations but they all end up with an error (TCP/IP Connection).

 

I did see a blog post about using Pyodbc, but was hoping to use JDBC using Spark SQL as that works without an issue in Data Bricks.

 

Thanks!

5 REPLIES 5
frithjof_v
Community Champion
Community Champion

Does it help to enable this setting?

 

"Allow service principals to use Power BI APIs"

 

https://debruyn.dev/2023/how-to-use-service-principal-authentication-to-access-microsoft-fabrics-one...

Thanks for your response. I did see the blog post from other threads, too, but I believe it's really about adding service principal to the workspace, not necessarily for SQL Endpoint using Service Principal. The setting is turned on for me regardless, and I am already able to use Data Studio and Dataflow to connect to the SQL endpoint, just that I couldn't find a way to do it using a Notebook and JDBC.

 

I also saw that there is a way to do it using Pyodbc, but that would require using Pandas then converting to PySpark. I was hoping to use JDBC directly in Spark as that works without an issue in Data Bricks.

 

Thanks!

Hi @w0ns0ng 

 

Thanks for using Microsoft Fabric Community.

Apologies for the delay in response.

I found an article which might help you. In this article they are using AAD/Entra username and password, but using other connection string options, I believe you can also use the same method to connect using Service Principle accounts.

 

I hope this information helps. If you have any further questions please do let us know.

 

Thanks.

Hi @w0ns0ng 

 

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others.
Otherwise, will respond back with the more details and we will try to help.


Thanks.

Hi @w0ns0ng 

 

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. In case if you have any resolution please do share that same with the community as it can be helpful to others.
If you have any question relating to the current thread, please do let us know and we will try out best to help you.
In case if you have any other question on a different issue, we request you to open a new thread.


Thanks.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.