1

I having trouble connecting to a SQL Server database on Azure. We've already added the IP address to the firewall exclusion list and the username/password work when connecting from other machines. We tried with both username/password and MFA.

What else could be causing the problem?

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.) (Microsoft SQL Server, Error: 121)

0

2 Answers 2

2

try to connect choosing the proper user database here:

enter image description here

Maybe the user you are using is not able to connect to the master database.

Here is how database firewall rules work:

https://learn.microsoft.com/it-it/azure/azure-sql/database/firewall-configure

1
  • 1
    Unfortuantely that didn't help. But I'll give you an up-vote anyways because I've seen that work in the past when someone can't login from any machine. Commented Feb 23, 2021 at 16:55
2

This most likely is related to network or latency where in connection is taking more time than expected.

Try increasing the connection time in SSMS to a larger value (60 seconds, for example):
(This is equivalent to Connection Timeout=60 in the connection string)

Connection Timeout

Update: also, check out this https://stackoverflow.com/questions/48978575/azure-sql-server-error-occurred-during-the-pre-login-handshake
Try the disconnect VPN advice

5
  • Connection time-out didn't help, though I've seen others try it with success. Commented Feb 23, 2021 at 16:56
  • I hope you're wrong about the VPN because I think this machine is inside the company network and disconnecting isn't an option. Commented Feb 23, 2021 at 16:56
  • @JonathanAllen and just to be 100% sure, it is SQL Server on a VM in Azure, not an Azure SQL DB, right ? Commented Feb 24, 2021 at 14:35
  • I believe that it is Azure SQL DB, not a VM. Commented Feb 24, 2021 at 18:33
  • @JonathanAllen maybe it has run out of sessions ? You know that Azure SQL DB has restrictions on how many sessions / connections it can handle, especially number of sessions running some requests (queries). Scale up Azure SQL DB to increase number of concurrent sessions, that could possibly help Commented Feb 25, 2021 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.