Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
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.
PYODBC_DRIVER = "{ODBC Driver 18 for SQL Server}"
pyOdbcConnString = "DRIVER={0};SERVER={1};DATABASE={2};Encrypt=yes;Authentication=ActiveDirectoryInteractive;UID=xx@xx.com".format(
PYODBC_DRIVER,
ServerName,
DatabaseName,
)
I am getting following error.
OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
Hi @sambathraj
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.
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)
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.
connection_str = "Driver={ODBC Driver 18 for SQL Server};Server={server};Database={Database};UID={username};Authentication=ActiveDirectoryInteractive;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
Hope this would be helpful. Let me know if you have any questions.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
SQL Authentication works fine. I was trying to use Managed Identity / logged in user Entra ID.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Fabric update to learn about new features.
User | Count |
---|---|
14 | |
6 | |
4 | |
2 | |
2 |