Connectivity architecture

This article explains the architecture of various components that direct network traffic to a server in Azure SQL Database. It covers different connection policies and how they affect clients connecting from within Azure and clients connecting from outside of Azure.

Connectivity architecture overview

The following diagram provides a high-level overview of the connectivity architecture.

Diagram that shows a high-level overview of the connectivity architecture.

The following steps describe how to establish a connection:

  1. Clients connect to the gateway that has a public IP address and listens on port 1433.

  2. Depending on the effective connection policy, the gateway redirects or proxies the traffic to the correct database cluster.

  3. Inside the database cluster, the gateway forwards traffic to the appropriate database.

Connection policy

Logical SQL servers support the following three options for the server's connection policy setting:

  • Redirect (recommended): Clients establish connections directly to the node hosting the database, which reduces latency and improves throughput. To use this mode for connections, clients need to:

    • Allow outbound communication from the client to all Azure SQL IP addresses in the region on ports in the range of 11000 to 11999. Use the Service Tags for SQL to make this easier to manage. If you're using Private Link, see Use Redirect connection policy with private endpoints for the port ranges to allow.

    • Allow outbound communication from the client to Azure SQL Database gateway IP addresses on port 1433.

    • When you use the Redirect connection policy, see the Azure IP Ranges and Service Tags - China Cloud for a list of your region's IP addresses to allow.

  • Proxy: In this mode, all connections go through the Azure SQL Database gateways, which increases latency and reduces throughput. To use this mode for connections, clients need to allow outbound communication from the client to Azure SQL Database gateway IP addresses on port 1433.

    • When you use the Proxy connection policy, see the Gateway IP addresses list later in this article for your region's IP addresses to allow.
  • Default: This connection policy is in effect on all servers after creation unless you explicitly alter the connection policy to either Proxy or Redirect. The default policy is:

    • Redirect for all client connections originating inside of Azure (for example, from an Azure Virtual Machine).

    • Proxy for all client connections originating outside (for example, connections from your local workstation).

For the lowest latency and highest throughput, we highly recommend the Redirect connection policy instead of the Proxy connection policy. However, you need to meet the extra requirements for allowing network traffic for outbound communication:

  • If the client is an Azure Virtual Machine, you can accomplish this requirement by using Network Security Groups (NSG) with service tags.

  • If the client connects from a workstation on-premises, you might need to work with your network admin to allow network traffic through your corporate firewall.

To change the connection policy, see Change the connection policy.

Connectivity from within Azure

If you connect from within Azure, your connections use a connection policy of Redirect by default. A Redirect policy means that after the TCP session is established, the client session redirects to the right database cluster. The destination virtual IP changes from the Azure SQL Database gateway to the cluster. All subsequent packets flow directly to the cluster, bypassing the gateway. The following diagram illustrates this traffic flow.

Diagram of the architecture overview of Azure SQL connectivity via redirection within Azure.

Connectivity from outside of Azure

If you connect from outside Azure, your connections use a connection policy of Proxy by default. A policy of Proxy means that the TCP session is established via the Azure SQL Database gateway and all subsequent packets flow via the gateway. The following diagram illustrates this traffic flow.

Diagram that shows how the TCP session is established via the Azure SQL Database gateway and all subsequent packets flow via the gateway.

Important

Open TCP ports 1434 and 14000-14999 to enable Connecting with DAC

Gateway IP addresses

This section lists the IP address ranges assigned to the regional gateways of SQL Database.

When the proxy connection policy is in effect, database clients must be able to reach all given IP addresses in all ranges for the region of the logical server. With the redirect connection type, clients must be able to reach a wider set of IP addresses. To accomplish this, use the Sql.<region> service tags in Azure. For more information, see Azure IP Ranges and Service Tags - China Cloud.

Clients connecting to private endpoints don't need connectivity to any of these ranges because a private endpoint has direct connectivity to the gateways.

Region name Gateway IP address ranges
China East 52.130.13.96/27, 52.130.112.136/29
China East 2 52.130.7.0/27, 52.130.120.88/29
China East 3 52.131.155.192/29, 163.228.53.32/27
China North 40.72.77.128/27, 52.130.128.88/29
China North 2 52.130.21.160/27, 52.130.40.64/29
China North 3 52.131.27.192/29, 159.27.21.32/27, 159.27.195.192/29, 159.27.203.192/29