Cannot connect to Azure SQL – Timed Out Error 258
Cannot connect to an Azure SQL Database? You get Cannot connect to Azure SQL – Timed Out Error 258.
And you have already tried out lots of things including Windows Azure SQL Database Connectivity Troubleshooting Guide and still cannot connect?
Cannot connect to *.database.windows.net.
Additional information: A network-related or instance-specific error occurred while establishing a connection to SQL Server The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (Provider: TCP Provider, error: O – The wait operation timed out.) (Microsoft SQL Server, Error: 258)
First of all you should know that SQL Server IP address is not static so creating an allow rule on your firewall based on the resolved IP address of your databasename.database.windows.net will not help you.
Your firewall rule may seem correct when you compare your destination IP to resolved IP address of your databasename.database.windows.net. Do not trust that as it gets another IP address while it connects.
So you need to obtain latest Microsoft Azure Datacenter IP Ranges from the website and check/modify your firewall rule destination/target IP address list to be able to connect.
This file contains the Compute IP address ranges (including SQL ranges) used by the Microsoft Azure Datacenters. A new xml file will be uploaded every Wednesday (Pacific Time) with the new planned IP address ranges. New IP address ranges will be effective on the following Monday (Pacific Time). Please download the new xml file and perform the necessary changes on your site before Monday.
Tip: There are hundreds of subnets for each Region, if you don’t have time to find a way to enter all of these subnets to your Azure outbound allow rule, try to connect your Azure SQL Database without any firewall and run netstat -n | find “:1433” to find the other IP address.
Hope it helps