Azure Private Endpointsπ
π What is an Azure Private Endpoint?π
- A private endpoint is a network interface in your Virtual Network (VNet) that connects you privately and securely to an Azure service.
- Instead of accessing the service (e.g., Storage, SQL Database, Cosmos DB, Key Vault) via a public IP, traffic flows through a private IP inside your VNet.
- Uses Azure Private Link technology.
π How It Worksπ
- You create a Private Endpoint for a resource (like a Storage Account).
- Azure assigns a private IP from your VNet to this endpoint.
- Your VNet traffic β goes through this private IP β securely reaches the Azure service β without leaving Microsoftβs backbone network.
- The serviceβs public endpoint is still there, but you can restrict/block it.
π Example: Azure Storage with Private Endpointπ
- You have a Storage Account
mystorage.blob.core.windows.net
. - Normally, youβd connect via the public internet using that FQDN.
- With a Private Endpoint, Azure will map:
- So apps in your VNet access Storage via private IP.
- You can then disable all public access to the Storage Account for max security.
β Benefitsπ
- Security: No public internet exposure.
- Compliance: Meets strict data residency/security requirements.
- Integration: Works with Azure PaaS (Storage, SQL, Cosmos DB, Key Vault, etc.) and your own services behind Azure Standard Load Balancer.
βοΈ Configuration Steps (High-Level)π
- Create a VNet & Subnet.
-
Create a Private Endpoint:
-
Choose target service (e.g., Storage Account β Blob).
- Pick the VNet + subnet.
- A NIC with private IP gets created.
-
Update DNS:
-
Ensure the service FQDN resolves to the private IP (via Azure Private DNS Zone).
-
Restrict Public Access:
-
Disable public network access on the resource.
π Azure CLI Exampleπ
# Create Private Endpoint for Storage Account
az network private-endpoint create \
--name mystorage-pe \
--resource-group myResourceGroup \
--vnet-name myVNet \
--subnet mySubnet \
--private-connection-resource-id $(az storage account show -n mystorage -g myResourceGroup --query id -o tsv) \
--group-id blob \
--connection-name mystorage-connection
# Link Private DNS Zone
az network private-dns zone create -g myResourceGroup -n "privatelink.blob.core.windows.net"
az network private-dns link vnet create -g myResourceGroup -n "link-myvnet" -z "privatelink.blob.core.windows.net" -v myVNet -e true
Architectureπ
π Real-World Use Casesπ
- Connect Azure SQL Database from on-prem β via ExpressRoute/VPN + private endpoint (no internet).
- Secure Azure Storage for Databricks / Synapse pipelines.
- Access Key Vault privately from inside a VNet.
Easier Explanationπ
In Azure, a Private Endpoint is a network interface that connects you privately and securely to a service powered by Azure Private Link.
Instead of accessing services over the public internet, a private endpoint lets you access them through your virtual network (VNet) using private IP addresses.
π Key Pointsπ
- Private IP β The service (e.g., Azure Storage, SQL Database, Key Vault, etc.) gets a private IP inside your VNet.
- No Public Exposure β Traffic stays within the Microsoft backbone network instead of going over the internet.
- DNS Integration β You use private DNS zones so that service names (e.g.,
mystorageaccount.blob.core.windows.net
) resolve to the private IP. - Secure Access β Only resources in your VNet (or peered VNets) can connect to the service.
- Isolation β You can disable all public access to the service and allow only private endpoint traffic.
β Example Scenariosπ
- Azure Storage Account: Instead of accessing a blob container over the internet, a private endpoint gives your VM a private IP connection.
- Azure SQL Database: Applications inside your VNet can connect privately without opening public firewall rules.
- Azure Key Vault: Secrets can be retrieved over a private IP, protecting against data exfiltration.
π How it worksπ
- You create a Private Endpoint in your VNet.
- Azure assigns a private IP from your VNet to that endpoint.
- When your application resolves the serviceβs FQDN, it gets the private IP (via DNS configuration).
- The traffic routes securely through Azure Private Link (Microsoft backbone).
π Think of it like this: Instead of going out to the internet and back into Azure services, Private Endpoints bring the service into your VNet using a private IP.
Private Endpoints vs Serivce Endpointsπ
Perfect question π β this comes up a lot in interviews. Letβs break it down:
πΉ Private Endpoint vs. Service Endpointπ
Feature | Private Endpoint | Service Endpoint |
---|---|---|
Connectivity | Connects to the service using a private IP inside your VNet. | Extends your VNet identity to the serviceβs public IP. Traffic still flows to the serviceβs public endpoint. |
Security | Service can be locked down to only allow private endpoints β No public exposure. | Service is still reachable on the public internet, but limited to specific VNet/subnet(s). |
Traffic Path | Goes through Azure backbone via Private Link β never leaves the Microsoft network. | Still reaches the serviceβs public endpoint, but Azure ensures it stays on the backbone (doesnβt traverse the open internet). |
DNS Requirement | Needs DNS zone integration so service FQDN resolves to the private IP. | No DNS changes needed (uses public IP). |
Granularity | Works at the instance level (e.g., a specific storage account, SQL DB, Key Vault). | Works at the service level (all storage accounts in a region, etc.). |
Access Control | You can disable public access completely and force all traffic through private endpoint. | Public access is still available unless explicitly restricted. |
Cost | Additional cost for Private Link/Private Endpoint. | No extra cost (free). |
Use Cases | High-security workloads, regulatory compliance, zero-trust architectures. | Simpler setup when you just want secure connectivity without exposing entire internet. |
π Exampleπ
-
If you have an Azure SQL Database:
-
Private Endpoint β Your app in VNet connects to SQL over a private IP. You can block all public access.
- Service Endpoint β Your app connects over SQLβs public IP, but Azure recognizes itβs coming from your VNet and allows it.
π In short:
- Private Endpoint = Private IP, highest security, service instanceβlevel.
- Service Endpoint = Public IP, simpler, service-level restriction.
Analogyπ
Great β letβs make this real-world and easy to remember π
π Analogy: Private Endpoint vs Service Endpointπ
Private Endpoint (VIP Door Inside Your House)π
- Imagine you hire a bank (Azure service) to keep your valuables.
- Instead of visiting their public branch office (internet), the bank builds a special private door inside your house that directly connects to your locker.
- Only you (inside your house / VNet) can use it.
- Outsiders canβt even see the lockerβs public branch anymore (because you can disable public access).
- More secure, but costs extra (youβre paying for that VIP private door).
Service Endpoint (Fast Lane to the Bank Branch)π
- You still go to the public branch office (public IP of service).
- But the bank recognizes you as a VIP customer from your gated community (VNet/subnet).
- They let you skip the long queue and give you a secure corridor directly into the branch.
- Others can still access the branch (public access remains).
- Free and simpler, but less private than the βdoor inside your house.β
π― Quick Mnemonicπ
- Private Endpoint = Private Door (service inside your VNet)
- Service Endpoint = VIP Lane (still public, just secured to your VNet)
Exampleπ
Great question β letβs go through an Azure Private Link example step by step.
πΉ What is Azure Private Link?π
Azure Private Link lets you access Azure services over a private IP address inside your Virtual Network (VNet).
- Without Private Link β your app connects to a public endpoint (internet-exposed).
- With Private Link β your app connects to a private endpoint (private IP in your VNet), but traffic still reaches the Azure service securely over Microsoftβs backbone network.
πΉ Example Scenarioπ
You have:
- An App VM in a Virtual Network.
- An Azure Storage Account.
π You want the VM to connect to the storage account securely without going over the public internet.
πΉ Step-by-Step Setupπ
1. Create a VNet + VMπ
# Create resource group
az group create -n myRG -l eastus
# Create VNet + subnet
az network vnet create \
--name myVNet \
--resource-group myRG \
--address-prefix 10.0.0.0/16 \
--subnet-name mySubnet \
--subnet-prefix 10.0.1.0/24
# Create VM in VNet (Linux example)
az vm create \
--resource-group myRG \
--name myVM \
--image UbuntuLTS \
--admin-username azureuser \
--generate-ssh-keys \
--vnet-name myVNet \
--subnet mySubnet
2. Create a Storage Accountπ
az storage account create \
--name mystoragepldemo \
--resource-group myRG \
--location eastus \
--sku Standard_LRS \
--kind StorageV2
3. Create a Private Endpointπ
This links the storage account to your VNet with a private IP.
az network private-endpoint create \
--resource-group myRG \
--name myPrivateEndpoint \
--vnet-name myVNet \
--subnet mySubnet \
--private-connection-resource-id $(az storage account show \
--name mystoragepldemo \
--resource-group myRG \
--query "id" -o tsv) \
--group-id blob \
--connection-name myConnection
--group-id blob
β connects specifically to Blob service.- A private IP (like
10.0.1.4
) is assigned insidemySubnet
.
4. Configure Private DNSπ
Private endpoints require DNS to resolve the storage account name to the private IP.
az network private-dns zone create \
--resource-group myRG \
--name "privatelink.blob.core.windows.net"
az network private-dns link vnet create \
--resource-group myRG \
--zone-name "privatelink.blob.core.windows.net" \
--name MyDNSLink \
--virtual-network myVNet \
--registration-enabled false
az network private-endpoint dns-zone-group create \
--resource-group myRG \
--endpoint-name myPrivateEndpoint \
--name MyZoneGroup \
--private-dns-zone "privatelink.blob.core.windows.net" \
--zone-name "privatelink.blob.core.windows.net"
Now, mystoragepldemo.blob.core.windows.net
resolves to the private IP (10.0.x.x) inside your VNet.
A Record mystorageacct.blob.core.windows.net β 10.0.1.4
created in the DNS
5. Test from VMπ
SSH into the VM:
Test DNS resolution:
β
Should resolve to 10.0.1.x
(private IP).
Test connectivity:
Traffic goes through the private endpoint, not the public internet.
πΉ Real-World Usesπ
- Databricks accessing ADLS Gen2 over private link.
- SQL Database private endpoint to keep DB off the public internet.
- Key Vault private endpoint so secrets are only accessible in-VNet.
- App Service β Storage Account private integration.
πΉ Key Benefitsπ
- Removes exposure to public internet.
- Simplifies network security (no IP whitelisting).
- Uses Microsoftβs backbone network for traffic.
- Works with Azure Monitor logs to track connections.