Connecting to Azure SQL database in Power BI desktop

Mateusz Maruszczyk 0 Reputation points
2024-09-16T14:42:20.87+00:00

I was trying to add Azure SQL database as data source in Power BI. While connecting to the server I got following error:

Microsoft SQL: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)

I've encountered it in Azure Data Studio as well, but there I was able to resolve it by changing the encryption settings. In Power Bi, I tried to use encrypted connection and extended the timeout error, none of those helped.

Any idea how to get that working?

Azure SQL Database
{count} votes

2 answers

Sort by: Most helpful
  1. Amira Bedhiafi 24,376 Reputation points
    2024-09-16T22:11:27.4366667+00:00

    Have your tried adding Encrypt=false to your connection string? or as mentioned above TrustServerCertificate=True

    In addition, you can also check that  if you have added the TCP port and UDP port(1434) in the inbound rule of the Windows Firewall, and you can verify TCP port in SQL Server Configuration Manager. For more details about configuring remote access for SQL Server, please review the following blog.

    2 other tasks :

    • Check Firewall and Network Security Rules
    • Consider Azure Active Directory Authentication

    https://github.com/dotnet/SqlClient/issues/1479

    0 comments No comments

  2. Oury Ba-MSFT 18,946 Reputation points Microsoft Employee
    2024-09-24T19:43:28.97+00:00

    Mateusz Maruszczyk Thank you for confirming that you finally figured out what the issue was. Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer. Accepted answers show up at the top, resulting in improved discoverability for others.

    Issue: "I was trying to add Azure SQL database as data source in Power BI. While connecting to the server I got following error:

    Microsoft SQL: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)"

    Solution: "My organization managed to rotate my IP address 3 times since my first attempt."

    If your issue remains unresolved or have further questions, please let us know in the comments how we can assist. We are here to help you and strive to make your experience better and greatly value your feedback.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.