SALES: 1-800-867-1380

Guidelines for Connecting to Azure SQL Database Programmatically

Updated: July 15, 2015

Microsoft Azure SQL Database works with third-party applications, open source, and many familiar Microsoft applications, such as ODBC and ADO.NET. This article contains general guidelines for connecting to Azure SQL Database using these technologies.

For additional details about connecting to Azure SQL Database, see the following:

The following table contains general guidelines for connecting to Azure SQL Database:

 

Area Guideline

Ports

The Azure SQL Database service is only available with TCP port 1433. To access Azure SQL Database from your computer, ensure that your firewall allows outgoing TCP communication on TCP port 1433.

Firewalls

Before you can connect to your Azure SQL Database server for the first time, you must use the Azure Management Portal to configure the Azure SQL Database firewall. You will need to create a server-level firewall setting that enables connection attempts from your computer or Azure to the Azure SQL Database server.

Further, if you want to control access at the database level in your Azure SQL Database server, you must create database-level firewall rules for those databases. For more information, see:

Connection strings

Because some tools implement tabular data stream (TDS) differently, you might need to append the Azure SQL Database server name to the login in the connection string by using the <login>@<server> notation. In these cases, separate the login and Azure SQL Database server name with the @ symbol.

For example, if your login was named login1 and the fully qualified name of your Azure SQL Database server is servername.database.windows.net, the username parameter of your connection string should be: login1@servername. This restriction places minor limitations on the text you can choose for the login name. For more information, see CREATE LOGIN (Transact-SQL).

If you do not specify a database in the connection string, you will be connected to the master database.

Transact-SQL statements

Not all embedded Transact-SQL statements are supported by Azure SQL Database. Some statements that are supported in Azure SQL Database might not support all of the same optional parameters as SQL Server. For more information about Transact-SQL support in Azure SQL Database, see Azure SQL Database Transact-SQL Reference.

The Transact-SQL USE command is not currently supported for switching between databases. Establish a connection directly to the target database.

Databases

You must connect to the master database to create logins and databases. The master database also has the sys.sql_logins and sys.databases views that you can use to view logins and databases, respectively. For more information, see Managing Databases, Logins, and Users in Azure SQL Database.

The situation is different if your Azure SQL Database V12 database is a contained database. The contained users in the database are not tied to any login in the master database.

The technologies in the following list are not supported when connecting to Azure SQL Database:

  • Windows Authentication. Use SQL Server authentication in your connection string instead.

  • OLE DB. However, you can connect to a SQL Server linked server with an application written with SQL Server Native Client OLE DB.

  • Distributed transactions. For more information, see Azure SQL Database General Guidelines and Limitations.

Also, be advised that Azure SQL Database provides its large-scale multi-tenant database service on shared resources. In order to provide availability to all Azure SQL Database customers, your connection to the service may be closed due throttling or worker thread compliancy limits.

For more information, see:

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft