Cannot connect to Azure SQL database, even with whitelisted IP
To summarize.
Windows Azure SQL Database (formerly known as SQL Azure) works exclusively and only on TCP port 1433. It only support SQL Server Authentication, TCP connection and TDS protocol as of today.
In order to successfully establish connection to SQL Azure one must fulfil the following requirements:
- Create SQL Azure server & Database
- Setup SQL Azure Server's firewall rules to accept connections from the IP address of application that will connect to that server
- Make sure the box (be it Virtual, or home, or whatever) has no blocking outbound TCP port 1433
- Explicitly force encryption in connection string
- Explicitly chose to not trust server certificate in connection string
Please note that many (if not all) ISPs (Internet Service Providers) and Hosters, as well as IT staff within companies DO block outgoing TCP Port 1433 due to the SQL Slammer worm. This outgoing port blocking appears to be one of the most faced issues of newcommers to SQL Azure.
UPDATE Nov. 2015
As of August 2015, there is preview feature that enables you to use Azure AD to authenticate to Azure SQL Database. You can read more on this new preview feature here: https://azure.microsoft.com/en-us/documentation/articles/sql-database-aad-authentication/
Cannot connect to Azure SQL from SSMS v17.6
You could verify the followings on your side:
- Whitelist the client IP in the firewall of Azure SQL server. It's a public IP from your client.
- By default, SQL Database communicates over port 1433. Outbound traffic over port 1433 might not be allowed by your network's firewall. You could open this port in the local firewall on the client machine or let your IT department opens port 1433 within a corporate network. You also could verify network connectivity via
telnet someservername.database.windows.net 1433
in the Command Prompt. - Use a correct FQDN SQL server name to connect such as
xxx.database.windows.net
. - Ensure you are using SQL Server Authentication. Use a correct login username and password.
You could get more details from this Quickstart.
How can I allow unknown users to access my SQL (Azure) DB?
It would be advisable to have some sort of middle ware access the db and not your clients directly.
However if you want any IP to be able to connect to the db just add this entry to the firewall list:
Azure Portal -> Databases -> Servers -> Configure and add the following rule:
Related Topics
Oracle SQL Date Range Intersections
Using a SQL Server for Application Logging. Pros/Cons
Why Is My Left Join Not Returning Nulls
What's the Recommended Location for SQL (Ddl) Scripts
How to Avoid SQL Query Timeout
How to Easily Edit SQL Xml Column in SQL Management Studio
Cross Apply Performance Difference
Oracle SQL Order by in Subquery Problems!
Check Users in a Security Group in SQL Server
Atomically Set Serial Value When Committing Transaction
Quickest/Easiest Way to Use Search/Replace Through All Stored Procedures
MySQL Join Two Tables Count and Sum from Second Table