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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
SaharRad
Regular Visitor

Sql database in Fabric

Hi everyone,
I’m trying to connect an ODBC data source to a SQL Database in Microsoft Fabric, but I’m facing this error:
Microsoft ODBC Driver for SQL Server Version 18.04.0001
Running connectivity tests...
Attempting connection
[Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Cannot open server
Here’s what I’ve done so far:
  1. Tried various authentication methods, including Microsoft Entra ID Password Authentication, but the connection still fails. In this method, I provided my login ID and password, but the issue persists.
  2. Confirmed that my email is added to the SQL database security settings in Microsoft Fabric.
  3. Verified the server name matches the connection string provided in Fabric.
Despite trying multiple configurations, the connection test continues to fail. Is there something I might be missing in the setup, or are there additional steps to enable external ODBC connections to Microsoft Fabric SQL databases?
 
Any advice or guidance would be greatly appreciated!
Thank you in advance!
 
When I tried to access the Azure portal using the business email account I created specifically for using Fabric, I encountered this error. It might be related to the issue I had when connecting to the server in the SQL database within Fabric.
SaharRad_0-1736537703381.png

 

 
1 ACCEPTED SOLUTION

Thank you for the response. 

I followed all the suggested steps:

  1. Confirmed DNS and network connectivity (nslookup, Test-NetConnection).
  2. Verified I have ODBC Driver 18 and pyodbc installed.
  3. Ran my Python script with ActiveDirectoryInteractive and also tried other auth methods.
  4. Checked my Azure tenant and found I have no valid subscription assigned or active.

It turns out my subscription status is causing the issue. I don’t have any active Azure subscription in my tenant.

 

View solution in original post

5 REPLIES 5
dlevy
Microsoft Employee
Microsoft Employee

Hi @SaharRad - Sorry to hear it's giving you trouble! If you are trying to run on a Windows machine the easiest way to get up and running quickly is to set up a DSN. That will help you work out an connectivity issues between your machine and the database. 

 

What language are you using? We have a bunch of samples out there that I could point you toward.

Hi, thanks for following up! I tried setting up a DSN as suggested, but unfortunately, I still couldn't connect to the server. I'm currently using Python for this project. If there are any specific samples or additional tips you could share for this language, that would be really helpful. Looking forward to your suggestions!

dlevy
Microsoft Employee
Microsoft Employee

If the ODBC GUI is not working to set up a connection then you may have something else going on.

 

Some key things are:

  1. You need the whole server name but should omit any leading characters, like "tcp:". The ",1433" at the end is optional.
  2. You need the whole database name, GUID and all. 
  3. Many drivers require the az cli to be installed https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli. Make sure to run an 'az login' after installing it.

 

Here's a basic python sample that will use the logged in users entra id: 

 

"""
Connects to a SQL database using pyodbc
"""
import pyodbc

connectionString = f'Driver={{ODBC Driver 18 for SQL Server}};Server=<server>;Database=<database>;Encrypt=yes;TrustServerCertificate=no;Authentication=ActiveDirectoryInteractive'
conn = pyodbc.connect(connectionString)

SQL_QUERY = """
select Opportunity_Number, ProductID, Opportunity_Created_On, Quantity, Comments from Opportunity where Opportunity_number = 'OPP-500'
"""

cursor = conn.cursor()
cursor.execute(SQL_QUERY)

records = cursor.fetchall()
for r in records:
    print(f"{r.Opportunity_Number}\t{r.ProductID}\t{r.Comments}")

 

Thank you for the response. 

I followed all the suggested steps:

  1. Confirmed DNS and network connectivity (nslookup, Test-NetConnection).
  2. Verified I have ODBC Driver 18 and pyodbc installed.
  3. Ran my Python script with ActiveDirectoryInteractive and also tried other auth methods.
  4. Checked my Azure tenant and found I have no valid subscription assigned or active.

It turns out my subscription status is causing the issue. I don’t have any active Azure subscription in my tenant.

 

dlevy
Microsoft Employee
Microsoft Employee

Oh, yep...that will do it. 😀

 

If it is a personal tenant then it is easy enough to create a subscription. If you are worried about accidental spending then just use a visa gift card to get started. You can always switch it out later.

 

For a work tenant that's probably going to require a meeting or at least a few well worded emails.

 

 

Helpful resources

Announcements
MarchFBCvideo - carousel

Fabric Monthly Update - March 2025

Check out the March 2025 Fabric update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

"); $(".slidesjs-pagination" ).prependTo(".pagination_sec"); $(".slidesjs-pagination" ).append("
"); $(".slidesjs-play.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-stop.slidesjs-navigation").appendTo(".playpause_sec"); $(".slidesjs-pagination" ).append(""); $(".slidesjs-pagination" ).append(""); } catch(e){ } /* End: This code is added by iTalent as part of iTrack COMPL-455 */ $(".slidesjs-previous.slidesjs-navigation").attr('tabindex', '0'); $(".slidesjs-next.slidesjs-navigation").attr('tabindex', '0'); /* start: This code is added by iTalent as part of iTrack 1859082 */ $('.slidesjs-play.slidesjs-navigation').attr('id','playtitle'); $('.slidesjs-stop.slidesjs-navigation').attr('id','stoptitle'); $('.slidesjs-play.slidesjs-navigation').attr('role','tab'); $('.slidesjs-stop.slidesjs-navigation').attr('role','tab'); $('.slidesjs-play.slidesjs-navigation').attr('aria-describedby','tip1'); $('.slidesjs-stop.slidesjs-navigation').attr('aria-describedby','tip2'); /* End: This code is added by iTalent as part of iTrack 1859082 */ }); $(document).ready(function() { if($("#slides .item").length < 2 ) { /* Fixing Single Slide click issue (commented following code)*/ // $(".item").css("left","0px"); $(".item.slidesjs-slide").attr('style', 'left:0px !important'); $(".slidesjs-stop.slidesjs-navigation").trigger('click'); $(".slidesjs-previous").css("display", "none"); $(".slidesjs-next").css("display", "none"); } var items_length = $(".item.slidesjs-slide").length; $(".slidesjs-pagination-item > button").attr("aria-setsize",items_length); $(".slidesjs-next, .slidesjs-pagination-item button").attr("tabindex","-1"); $(".slidesjs-pagination-item button").attr("role", "tab"); $(".slidesjs-previous").attr("tabindex","-1"); $(".slidesjs-next").attr("aria-hidden","true"); $(".slidesjs-previous").attr("aria-hidden","true"); $(".slidesjs-next").attr("aria-label","Next"); $(".slidesjs-previous").attr("aria-label","Previous"); //$(".slidesjs-stop.slidesjs-navigation").attr("role","button"); //$(".slidesjs-play.slidesjs-navigation").attr("role","button"); $(".slidesjs-pagination").attr("role","tablist").attr("aria-busy","true"); $("li.slidesjs-pagination-item").attr("role","list"); $(".item.slidesjs-slide").attr("tabindex","-1"); $(".item.slidesjs-slide").attr("aria-label","item"); /*$(".slidesjs-stop.slidesjs-navigation").on('click', function() { var itemNumber = parseInt($('.slidesjs-pagination-item > a.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); });*/ $(".slidesjs-stop.slidesjs-navigation, .slidesjs-pagination-item > button").on('click keydown', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); var itemNumber = parseInt($('.slidesjs-pagination-item > button.active').attr('data-slidesjs-item')); $($('.item.slidesjs-slide')[itemNumber]).find('.c-call-to-action').attr('tabindex', '0'); }); $(".slidesjs-play.slidesjs-navigation").on('click', function() { $.each($('.item.slidesjs-slide'),function(i,el){ $(el).find('.c-call-to-action').attr('tabindex', '-1'); }); }); $(".slidesjs-pagination-item button").keyup(function(e){ var keyCode = e.keyCode || e.which; if (keyCode == 9) { e.preventDefault(); $(".slidesjs-stop.slidesjs-navigation").trigger('click').blur(); $("button.active").focus(); } }); $(".slidesjs-play").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-stop").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-play")) { $(".slidesjs-stop").focus(); } } }); $(".slidesjs-stop").on("click",function (event) { if (event.handleObj.type === "click") { $(".slidesjs-play").focus(); } else if(event.handleObj.type === "keydown"){ if (event.which === 13 && $(event.target).hasClass("slidesjs-stop")) { $(".slidesjs-play").focus(); } } }); $(".slidesjs-pagination-item").keydown(function(e){ switch (e.which){ case 37: //left arrow key $(".slidesjs-previous.slidesjs-navigation").trigger('click'); e.preventDefault(); break; case 39: //right arrow key $(".slidesjs-next.slidesjs-navigation").trigger('click'); e.preventDefault(); break; default: return; } $(".slidesjs-pagination-item button.active").focus(); }); }); // Start This code is added by iTalent as part of iTrack 1859082 $(document).ready(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); $("#tip2").attr("aria-hidden","true").addClass("hidden"); $(".slidesjs-stop.slidesjs-navigation, .slidesjs-play.slidesjs-navigation").attr('title', ''); $("a#playtitle").focus(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").mouseover(function(){ $("#tip1").attr("aria-hidden","false").removeClass("hidden"); }); $("a#playtitle").blur(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#playtitle").mouseleave(function(){ $("#tip1").attr("aria-hidden","true").addClass("hidden"); }); $("a#play").keydown(function(ev){ if (ev.which ==27) { $("#tip1").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); $("a#stoptitle").focus(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").mouseover(function(){ $("#tip2").attr("aria-hidden","false").removeClass("hidden"); }); $("a#stoptitle").blur(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").mouseleave(function(){ $("#tip2").attr("aria-hidden","true").addClass("hidden"); }); $("a#stoptitle").keydown(function(ev){ if (ev.which ==27) { $("#tip2").attr("aria-hidden","true").addClass("hidden"); ev.preventDefault(); return false; } }); }); // End This code is added by iTalent as part of iTrack 1859082
Top Kudoed Authors