Configuring Private Endpoints
This lesson explains how private endpoints work, why DNS is central, and how to control them.
Learning outcomes
After completing this lesson, you will be able to:
- Explain the benefit of a private endpoint.
- Describe the approval states.
- Diagnose a DNS failure.
- Explain subnet network policies.
The problem with public PaaS endpoints
By default, a PaaS service such as Azure SQL, Azure Storage or Key Vault has a public endpoint. Even with firewall rules, the address is on the internet. A private endpoint is a network interface with a private IP address in your subnet that connects to one specific resource, through Azure Private Link. Traffic stays on the Microsoft backbone, and the service can then have its public endpoint disabled, which removes it from the internet.
Because the connection maps to one resource, a private endpoint also limits data exfiltration. A service endpoint gives a subnet access to a whole service, which might include an attacker's storage account in another tenant. A private endpoint reaches only the resource that it was created for.
Creating and approving a connection
A private endpoint needs a virtual network, a subnet, a target resource and a target sub-resource, such as blob, sqlServer or vault. It must be in the same region and subscription as its virtual network, though the target resource can be in another region.
Connections are approved automatically if the requester has rights on the target, and otherwise manually. The states are Pending, Approved, Rejected and Disconnected. Manual approval is common across teams or tenants: a network team creates an endpoint, and the resource owner approves it on the resource's Networking page.
The endpoint that does not work
Why DNS matters
Clients connect by name, and TLS certificates expect that name. The private endpoint works only if the name resolves to the private address. For a storage account, the public name account.blob.core.windows.net has a CNAME to account.privatelink.blob.core.windows.net. In a private DNS zone named privatelink.blob.core.windows.net, linked to the virtual network, that name resolves to the private address. Clients outside the zone still resolve the public address.
The following table lists common zones.
| Service | Sub-resource | Private DNS zone |
|---|---|---|
| Azure Blob Storage | blob | privatelink.blob.core.windows.net |
| Azure SQL Database | sqlServer | privatelink.database.windows.net |
| Azure Key Vault | vault | privatelink.vaultcore.azure.net |
| Azure Container Registry | registry | privatelink.azurecr.io |
| Azure App Service | sites | privatelink.azurewebsites.net |
Most faults with private endpoints are DNS faults. If a client resolves a public address, then the connection fails when public access is disabled. Test with nslookup from the client. For on-premises clients, configure a conditional forwarder to a DNS resolver in Azure, such as Azure DNS Private Resolver, since on-premises servers cannot query the zone directly. Connecting to the service by its private IP address fails TLS validation, so do not use that as a shortcut.
The following diagram shows how the public name resolves to the private address.

Keep the public name
Do not change the application's connection string to use the privatelink name. Clients should keep using the public name, and DNS should do the redirection.
Private DNS zones
Securing the endpoint
By default, NSG rules and UDRs do not apply to traffic to a private endpoint. To apply them, enable network policies on the subnet, for NSGs, route tables or both. The private endpoint's NIC can also be a member of an ASG, with a limit of 50 members for each.
A private endpoint does not itself close the public endpoint: the service stays public until you disable it. Disable public network access on the target, or restrict it with the firewall. A static IP address can be set for most services, though not for some, such as AKS or Application Gateway. Traffic that passes through a network virtual appliance should use SNAT, as Microsoft recommends, to avoid return traffic bypassing the appliance. Authorization still applies, so a caller on the private network needs a role.
Securing a private endpoint
Azure Policy and scale
Azure Policy helps at scale. Built-in definitions can audit whether a service uses a private endpoint, deny public network access, and deploy DNS zone groups automatically, so that the DNS record is created when an endpoint is created. A central team often owns the private DNS zones in a hub, with a DeployIfNotExists policy to link endpoints to them.
Creating an endpoint
The following commands create a private endpoint for a storage account's blob service, with the DNS zone and link. A zone group then keeps the record up to date.
ACCOUNT_ID=$(az storage account show --name ACCOUNT --resource-group RG --query id -o tsv)
az network private-endpoint create --resource-group RG --name pe-blob --vnet-name VNET --subnet SUBNET \
--private-connection-resource-id "$ACCOUNT_ID" --group-id blob --connection-name blob-connection
az network private-dns zone create --resource-group RG --name privatelink.blob.core.windows.net
az network private-dns link vnet create --resource-group RG --zone-name privatelink.blob.core.windows.net \
--name link-vnet --virtual-network VNET --registration-enabled false
az network private-endpoint dns-zone-group create --resource-group RG --endpoint-name pe-blob --name default \
--private-dns-zone privatelink.blob.core.windows.net --zone-name blobA connection that still goes public
After creating a private endpoint for a Key Vault and disabling public access, a VM in a peered spoke fails with a forbidden error, and nslookup from the VM returns a public address. The private DNS zone is linked to the hub network only. What is the problem, and what should you fix?
The name resolves to a public address, so the request is going to the public endpoint, which is disabled. The zone is linked only to the hub, and a zone link is not transitive through peering. Link privatelink.vaultcore.azure.net to the spoke network, or have the spoke use a DNS server in the hub that can resolve the zone.
Enabling public access would hide the problem and undo the design. Adding the VM's IP address to the firewall does not help when public access is disabled. Changing the application to the privatelink name is not the supported approach.
Why should applications not connect to a service by its private IP address?
Show answer
TLS validation fails, because the certificate is for the service name. DNS should resolve the normal name.
Exam Tips
Remember for the exam
- A private endpoint connects to one resource, which helps to stop exfiltration.
- DNS is the most common failure, so test with nslookup.
- Private endpoints do not disable the public endpoint.
- Enable subnet network policies for NSGs to apply to endpoint traffic.