<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Connect to Azure SQL using Microsoft EntraID from Fabric Notebook in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Connect-to-Azure-SQL-using-Microsoft-EntraID-from-Fabric/m-p/4258719#M4809</link>
    <description>&lt;P&gt;SQL Authentication works fine. I was trying to use Managed Identity / logged in user Entra ID.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 26 Oct 2024 01:26:38 GMT</pubDate>
    <dc:creator>sambathraj</dc:creator>
    <dc:date>2024-10-26T01:26:38Z</dc:date>
    <item>
      <title>Connect to Azure SQL using Microsoft EntraID from Fabric Notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Connect-to-Azure-SQL-using-Microsoft-EntraID-from-Fabric/m-p/4117754#M3767</link>
      <description>&lt;P&gt;I am trying to connect to the Azure SQL data base from Fabric notebook using my credentials. I was hoping my logged in credentials will be used to get the data from the server. I am able to connect using SSMS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PYODBC_DRIVER = "{ODBC Driver 18 for SQL Server}"&lt;BR /&gt;pyOdbcConnString = "DRIVER={0};SERVER={1};DATABASE={2};Encrypt=yes;Authentication=ActiveDirectoryInteractive;UID=xx@xx.com".format(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PYODBC_DRIVER,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ServerName,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DatabaseName,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/P&gt;&lt;P&gt;I am getting following error.&amp;nbsp;&lt;BR /&gt;OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 04:45:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Connect-to-Azure-SQL-using-Microsoft-EntraID-from-Fabric/m-p/4117754#M3767</guid>
      <dc:creator>sambathraj</dc:creator>
      <dc:date>2024-08-26T04:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Connect to Azure SQL using Microsoft EntraID from Fabric Notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Connect-to-Azure-SQL-using-Microsoft-EntraID-from-Fabric/m-p/4122291#M3786</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/797030"&gt;@sambathraj&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I haven't tested Microsoft Entra ID authentication yet. I tested with SQL authentication with below code in a notebook successfully. You may try changing the connection string accordingly.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import pyodbc

servername = 'your server name'
databasename = 'your db name'
username = 'sql user name'
password = 'xxxxxx'

connection_string = f"Driver={{ODBC Driver 18 for SQL Server}};Server=tcp:{servername}.database.windows.net,1433;Database={databasename};Uid={username};Pwd={password};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"

query_string = 'select top 10 * from SalesLT.ProductCategory'

conn = pyodbc.connect(connection_string)
cursor = conn.cursor()
cursor.execute(query_string)
resultList = cursor.fetchall()
for row in resultList:
    print(row)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vjingzhanmsft_0-1724830036787.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1158305iFCD03BE74882C394/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vjingzhanmsft_0-1724830036787.png" alt="vjingzhanmsft_0-1724830036787.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try adding connection timeout to the connection string. Also ensure that your client IP address has been added in Firewall rules of the Azure SQL database or server.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;connection_str = "Driver={ODBC Driver 18 for SQL Server};Server={server};Database={Database};UID={username};Authentication=ActiveDirectoryInteractive;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this would be helpful. Let me know if you have any questions.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Jing&lt;BR /&gt;&lt;EM&gt;If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos! &lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 08:06:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Connect-to-Azure-SQL-using-Microsoft-EntraID-from-Fabric/m-p/4122291#M3786</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-28T08:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Connect to Azure SQL using Microsoft EntraID from Fabric Notebook</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Connect-to-Azure-SQL-using-Microsoft-EntraID-from-Fabric/m-p/4258719#M4809</link>
      <description>&lt;P&gt;SQL Authentication works fine. I was trying to use Managed Identity / logged in user Entra ID.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2024 01:26:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Connect-to-Azure-SQL-using-Microsoft-EntraID-from-Fabric/m-p/4258719#M4809</guid>
      <dc:creator>sambathraj</dc:creator>
      <dc:date>2024-10-26T01:26:38Z</dc:date>
    </item>
  </channel>
</rss>

