Microsoft Azure Documentation

Azure SQL Database Private Endpoints

This document provides a comprehensive guide on using private endpoints with Azure SQL Database. Private endpoints enable secure and private connectivity to your Azure SQL Database from within your virtual network, without exposing your database to the public internet.

Key Benefit: Private endpoints leverage Azure Private Link technology, ensuring that traffic to your Azure SQL Database travels over a private IP address within your virtual network.

What are Private Endpoints?

A private endpoint is a network interface that connects any Azure private link service, like Azure SQL Database, securely to your virtual network. It uses a private IP address from your virtual network, effectively bringing the service into your network.

Why Use Private Endpoints for Azure SQL Database?

How to Create a Private Endpoint

You can create a private endpoint for your Azure SQL Database using the Azure portal, Azure CLI, Azure PowerShell, or ARM templates.

Using the Azure Portal:

  1. Navigate to your Azure SQL Database server in the Azure portal.
  2. Under "Settings," select "Networking."
  3. Click on the "Private endpoint connections" tab.
  4. Click "+ Add" to create a new private endpoint.
  5. Fill in the required details: Subscription, Resource Group, Name, Region, Virtual Network, and Subnet.
  6. Under "Resource," select "Microsoft.Sql/servers" and choose your SQL server.
  7. For "Target sub-resource," select "sqlServer."
  8. Review and create the private endpoint.
Ensure your virtual network has DNS resolution configured to correctly resolve the private endpoint's IP address. You may need to set up a Private DNS Zone.

Azure CLI Example:


az network private-endpoint create \
    --name MyPrivateEndpoint \
    --resource-group MyResourceGroup \
    --vnet-name MyVnet \
    --subnet MySubnet \
    --name MyPrivateEndpoint \
    --private-connection-resource-id "/subscriptions/YOUR_SUBSCRIPTION_ID/resourceGroups/MyResourceGroup/providers/Microsoft.Sql/servers/my-sql-server" \
    --group-ids sqlServer
            

Configuring DNS Resolution

For private endpoints to work correctly, your applications need to resolve the fully qualified domain name (FQDN) of your SQL Server to the private IP address assigned to the private endpoint. This is typically achieved by:

Connecting to Azure SQL Database with a Private Endpoint

Once the private endpoint is created and DNS is configured, your applications running within the associated virtual network (or peered networks) can connect to your Azure SQL Database using its standard FQDN (e.g., my-sql-server.database.windows.net). The DNS resolution will automatically direct traffic to the private IP address of the private endpoint.

Remember to update your application connection strings if you are migrating from public endpoint access to private endpoint access.

Monitoring and Management

You can monitor the status of your private endpoint connections and manage them through the Azure portal's "Networking" settings for your SQL Server.

Considerations