Migrate to Innovate Summit:
Learn how migrating and modernizing to Azure can boost your business's performance, resilience, and security, enabling you to fully embrace AI.Register now
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This article walks through the basic considerations that a developer should be aware of when writing code to connect to your database in Azure. This article applies to Azure SQL Database, and Azure SQL Managed Instance.
You can leverage open-source tools like cheetah, sql-cli, VS Code. Additionally, Azure SQL Database works with Microsoft tools like Visual Studio and SQL Server Management Studio. You can also use the Azure portal, PowerShell, and REST APIs to help you gain additional productivity.
Authentication
Access to Azure SQL Database is protected with logins and firewalls. Azure SQL Database and SQL Managed Instance support users and logins for both SQL authentication and authentication with Microsoft Entra ID (formerly Azure Active Directory). Microsoft Entra logins are generally available in SQL Managed Instance and are in Public Preview for Azure SQL Database.
In your client connection logic, override the default timeout to be 30 seconds. The default of 15 seconds is too short for connections that depend on the internet.
If you are using a connection pool, be sure to close the connection the instant your program is not actively using it, and is not preparing to reuse it.
Avoid long-running transactions because any infrastructure or connection failure might roll back the transaction. If possible, split the transaction in the multiple smaller transactions and use batching to improve performance.
It's possible to connect your application to your Azure SQL resource by using the following languages:
Azure SQL Database is a cloud service where you might expect transient errors that happen in the underlying infrastructure or in the communication between cloud entities. Although Azure SQL Database is resilient on the transitive infrastructure failures, these failures might affect your connectivity. When a transient error occurs while connecting to SQL Database, your code should retry the call. We recommend that retry logic use backoff logic, so that it does not overwhelm the service with multiple clients retrying simultaneously. Retry logic depends on the error messages for SQL Database client programs.
On the computer that hosts your client program, ensure the firewall allows outgoing TCP communication on port 1433. More information: Configure an Azure SQL Database firewall.
If your client program connects to SQL Database while your client runs on an Azure virtual machine (VM), you must open certain port ranges on the VM. More information: Ports beyond 1433 for ADO.NET 4.5 and SQL Database.
Learn how Azure SQL Database works, the key concepts, and practical examples to help developers effectively utilize Azure SQL Database in their cloud-based applications.
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.