Cloud & Automation

How to Secure SQL Endpoints in Azure: Application Gateway vs Private Link

Choose private connectivity or an Application Gateway proxy for SQL Server, Azure SQL and Fabric endpoints, with accurate WAF, TDS and TLS boundaries.

By JaviPublished 14 min readIntermediate

Putting SQL behind the gateway can mean two very different things. Azure Application Gateway’s Web Application Firewall inspects HTTP(S) web requests. SQL clients speak Tabular Data Stream (TDS), usually over TCP 1433. A Layer 4 TCP/TLS proxy can forward that connection in documented scenarios, but it does not turn SQL traffic into HTTP or provide WAF inspection of SQL statements.

Start with the access path users actually need. Most applications should expose an HTTPS application or API and reach the database over private connectivity. Direct client access to TDS is a separate requirement that needs a private network or a carefully constrained TCP design.

Three distinct architectures

1. HTTPS application with private database access

This is the common application pattern. Application Gateway WAF can help protect the HTTP application entry point from web-layer attacks. The application connects to Azure SQL by private endpoint or another supported private path, using authentication, authorization, and least privilege. The gateway is not interposed to inspect TDS.

2. Direct private SQL client connection

When administrators, analysts, or an application need TDS access, connect from a controlled network. A private endpoint maps the service to private IP connectivity; private DNS and routes must resolve and reach it correctly. Network reachability does not grant database permissions, and SQL permissions do not make a public network path private.

3. Layer 4 proxy to SQL Server on a VM

Microsoft documents an Application Gateway Layer 4 configuration with a SQL Server VM backend and a SQL client test. The gateway listener, frontend, backend pool, routing rule, and backend setting define a TCP or TLS proxy path. Health probes and backend reachability must match the VM configuration; use gateway diagnostics and SQL-side logs to troubleshoot both halves of the connection.

Microsoft currently labels Application Gateway TCP/TLS Layer 4 proxying as Preview in its FAQ. The setup guide documents Standard v2 and WAF v2 tiers; in hybrid mode, WAF capabilities apply only to HTTP(S), not the Layer 4 TCP/TLS path. Treat this as a preview feature: verify regional support, limitations, and current status before production use. The boundary is simple: Application Gateway WAF evaluates supported HTTP(S) requests. It does not inspect SQL statements or TDS traffic the way it inspects HTTP. Layer 4 TCP/TLS proxying forwards a transport connection; it is not SQL-aware WAF protection. The SQL Server VM walkthrough configures a TCP/TLS listener, backend pool, routing rule, and backend setting. This is an exceptional direct-TCP architecture, not the default database-protection pattern.

TDS, TLS, and server names

Database proxying is not HTTPS reverse proxying. TDS has its own connection negotiation and can then use TLS. Microsoft calls out two important constraints for Layer 4 proxying:

  • Strict server-name validation: the backend SQL service can reject a connection when the server name requested by the client does not match the identity expected by the backend. Test the exact hostname and certificate behavior in the intended topology.
  • TLS termination depends on protocol order: gateway TLS termination is feasible only when TLS negotiation occurs before the TDS session begins. If TDS begins before TLS negotiation, termination at the Layer 4 gateway is unsupported; TCP passthrough is the documented alternative.

Passthrough means the gateway forwards the TCP flow without decrypting the SQL session. Do not assume it can parse login payloads, filter statements, or apply HTTP WAF rules. Encryption, certificate validation, authentication, database permissions, and auditing remain responsibilities of the endpoint and client configuration.

Azure SQL: use the managed service’s network controls

Azure SQL Database is a managed PaaS service: start with its supported Private Link/private endpoint and public network access controls, rather than inserting a VM-oriented proxy. SQL Server on an Azure VM is IaaS: you own its subnet, NIC, OS firewall, SQL listener, patching, and host hardening, so private VNet access is usually the direct design and Layer 4 proxying is an option only for a specific TCP access need. Fabric Warehouse, the Lakehouse SQL analytics endpoint, and SQL database in Fabric are service-managed TDS endpoints with Fabric-specific Private Link support; use that service networking model, not a public SQL VM proxy pattern. Restrict or disable public network access where the scenario supports it, use server/database firewall controls as appropriate, and connect through a VNet, VPN, or ExpressRoute path. Select Microsoft Entra authentication where suitable, grant only needed database roles and permissions, and audit access. Application Gateway is ordinarily for an application front end; it is not a required database hop or a SQL WAF.

The exact private connectivity option depends on the managed SQL offering and deployment model. A SQL Server VM is infrastructure you operate: its subnet, OS firewall, SQL listener, patching, and instance configuration are yours. Azure SQL is a managed service with service-specific private endpoint and public network settings. Apply the right service documentation rather than transferring VM assumptions to a PaaS endpoint.

Microsoft Fabric TDS endpoints

Warehouse and Lakehouse SQL analytics endpoints expose TDS connection strings for clients such as SSMS. Microsoft documents TDS connections through Fabric Private Link for Warehouse, Lakehouse SQL analytics endpoints, and SQL database in Fabric, with endpoint-specific tenant/workspace configuration and limitations. The workspace-level support documentation describes the Warehouse and SQL analytics endpoint connection-string forms and confirms SSMS connectivity. Use only those documented endpoint types and verify the current tenant setting, workspace mode, client path, and item-specific prerequisites. Validate the exact item, tenant setting, workspace mode, client path, and current limitations in the Fabric support matrix before rollout. Do not assume every Fabric workload or portal feature behaves identically under private-link restrictions.

Private Link is the relevant private-connectivity story for Fabric SQL/TDS access. It does not mean the Fabric SQL endpoint should normally be put behind a public Application Gateway. Fabric’s service-level networking and supported private-link configuration determine the endpoint path; the gateway’s HTTP WAF is not a SQL inspection layer.

When Azure Firewall may fit

Azure Firewall may be a better network control point when a design needs centralized network rules, supported FQDN/application rules for applicable flows, or controlled routing around private endpoints. It operates at network/application policy layers supported by its rule types; this still is not equivalent to parsing and authorizing SQL statements. Private endpoint routing, DNS, symmetric paths, and any source network address translation (SNAT) behavior should be checked against the selected topology. Keep policy and route design explicit to avoid bypass paths or unexpected source addresses.

Compare the controls

Control Best for Protocol WAF inspection? Private IP? Typical SQL use
Application Gateway WAF HTTP application entry point HTTP(S) Yes, for supported web traffic; not SQL/TDS Gateway frontend can be private or public Protect app/API, which then accesses SQL privately
Application Gateway Layer 4 TCP/TLS Documented TCP/TLS proxy scenarios TCP/TLS No SQL/TDS WAF inspection Frontend/backend network configuration dependent Exceptional SQL Server VM proxy path; validate current availability and TLS constraints
Private Link / Private Endpoint Private service connectivity Service protocol, including supported TDS paths No Yes, private endpoint NIC/IP Azure SQL or supported Fabric endpoint private access
Azure Firewall Central network filtering and routing Network rules and supported application/FQDN rules No SQL WAF Private network appliance path Govern traffic around private endpoints and VNets
VPN / ExpressRoute Private connectivity from networks or sites Routed IP; SQL uses TDS over TCP No Private routed path Bring client network to VNet/private endpoint

Choose by service and client

Target Recommended starting point Where Application Gateway fits
SQL Server VM Private VNet access; VPN/ExpressRoute for remote clients; harden OS and SQL Layer 4 proxy is possible in documented configurations, but is not WAF inspection; use only with a clear requirement and tested TDS/TLS behavior
Azure SQL Private endpoint/private access, network restrictions, Entra or appropriately managed authentication, least privilege Usually front the application, not the database; no SQL WAF role
Fabric Warehouse Supported TDS access through Fabric Private Link; verify tenant/workspace scope and connection string Not the standard protection layer; do not put the endpoint behind a public gateway
Fabric Lakehouse SQL analytics endpoint Supported TDS access through Fabric Private Link; verify workspace connection string and limits Same: use Fabric private connectivity, not public Application Gateway
SQL database in Fabric Microsoft documents TDS clients such as SSMS through Private Link; verify item and tenant/workspace prerequisites Same: use the supported Fabric private path, not a public SQL proxy

Fabric Private Link has material workload-specific constraints. For example, the tenant-level setting can affect Spark and other operations, and workspace-level support is not identical across item types. Consult the live supported-scenarios and limitations pages before enabling it across a tenant; validate the effect on OneLake, portal, pipeline, and engineering workflows needed by that workspace.

Threat model and the common anti-pattern

Private networking reduces reachable paths; it does not stop a compromised credential from accessing objects it is authorized to use. A WAF addresses supported HTTP attacks against the web app. A firewall can constrain network paths. Private Link avoids making a service endpoint reachable through a public route in the intended design. None replaces Entra or SQL authentication, database authorization, least privilege, auditing, secret management, or secure application code.

Avoid the default pattern Internet → public TCP 1433 → database. It exposes a powerful protocol and attracts scanning and credential attacks. If direct public TDS is required for a narrowly defined operational reason, document the requirement, restrict source ranges, enforce strong authentication and encryption, monitor attempts, and review whether a private client path can meet the need.

Practical review before deployment

  1. Name the client, target service, and required protocol. Separate browser HTTPS from direct TDS.
  2. Prefer a private route for database access and verify DNS, routes, endpoint policies, and network restrictions from the actual client network.
  3. For Application Gateway TCP/TLS, confirm current SKU, region, availability status, server-name behavior, protocol/TLS order, health checks, and diagnostics in Microsoft’s current instructions.
  4. Verify authentication, database grants, encryption, auditing, and secret handling independently of network controls.
  5. Test allowed and denied paths, including failure behavior, then monitor both network and SQL logs.

Related reading: Designing scalable Microsoft Fabric architecture, Fabric Lakehouse vs Warehouse, the Microsoft Fabric hub, the Governance & Security hub, and the SQL Server hub.

Sources and further reading

Screenshot plan

Optional real captures: Application Gateway TCP listener and backend settings for a SQL VM lab; a Private Endpoint and DNS configuration; Fabric’s applicable private-link setting; and a verified SSMS connection through the private route. Capture from a real test environment and redact tenant, IP, and identity details. No screenshots are fabricated.

  1. Internet user
  2. HTTPS
    Application Gateway WAF
  3. private route
    Web API
  4. TDS
    Private Link
  5. SQL service
Application and HTTP security path
  1. SSMS / DBA client
  2. private network
    VPN / ExpressRoute / VNet
  3. TDS
    Private Endpoint
  4. Supported Azure SQL or Fabric endpoint
Private SQL client path
  1. SQL client
  2. TCP/TLS proxy
    Application Gateway Layer 4
  3. SQL Server VM
Exceptional direct TCP proxy path
  1. Do users need direct SQL/TDS?
    • No: HTTPS app and WAF for HTTPUse a private SQL route from the app
    • Yes: direct SQL client requiredPrefer VPN/VNet and supported Private Link. Public TCP is exceptional; L4 is Preview and has no SQL WAF.
Do users need direct SQL/TDS?

Tags

  • Azure
  • SQL Server
  • Cloud Architecture
  • Azure
  • Microsoft Fabric