Service Endpoints
When to use · creating endpoints · service endpoint policies · access from on-premises
By the tools4free.dev team · Last reviewed November 13, 2026
Practice questions for this topic →
What a service endpoint does
A service endpoint extends your virtual network identity to an Azure service over the Azure backbone. You then add a virtual network rule on the service so that only your subnet can reach it. Microsoft recommends Private Link and private endpoints for private access to Azure services.
| Service endpoint | Private endpoint | |
|---|---|---|
| Address used | Service keeps its public IP; DNS is unchanged | Private IP in your subnet; DNS must resolve to it |
| Scope | Enabled per service, per subnet | One endpoint per resource and subresource |
| From on-premises | Not usable; allow public or NAT IPs in the service firewall | Reachable over VPN or ExpressRoute |
| Extra cost | None | See Azure Private Link pricing |
- Benefits: no reserved public IPs for IP firewalls, no NAT or gateway devices, and optimal routing. Service traffic stays on the backbone even when forced tunneling sends internet traffic to on-premises or an NVA.
- Virtual network address spaces can overlap, so they cannot identify your traffic. A service endpoint extends the virtual network identity to the service.
- Adding a virtual network rule removes public internet access to the resource and allows only your virtual network.
- Limits: Resource Manager virtual networks only; not usable for on-premises traffic. For Azure SQL, the endpoint applies only within the virtual network's region. One virtual network can be tied to up to 500 subscriptions and regions per service with active virtual network rules.
- Service endpoints cost nothing extra, and the number of endpoints in a virtual network is not limited.
- A standard service endpoint (network identifiers and network security perimeter integration) is in public preview.
Supported services
| Service | Endpoint resource |
|---|---|
| Azure Storage | Microsoft.Storage |
| Azure Storage cross-region | Microsoft.Storage.Global |
| Azure SQL Database | Microsoft.Sql |
| Azure Cosmos DB | Microsoft.AzureCosmosDB |
| Azure Key Vault | Microsoft.KeyVault |
| Azure Service Bus | Microsoft.ServiceBus |
| Azure Event Hubs | Microsoft.EventHub |
| Azure App Service | Microsoft.Web |
| Azure Cognitive Services | Microsoft.CognitiveServices |
| Azure Container Registry | Microsoft.ContainerRegistry |
Select the Microsoft.* resource on the subnet side. The service side then needs a virtual network rule (for Storage, set the default action to Deny and add a network rule for the subnet).
Creating service endpoints
- Enable endpoints per service, per subnet. Any compute in the subnet uses them, and one subnet can have several.
- To secure a service to several subnets or peered networks, enable endpoints on each subnet.
- For Azure SQL Database, the virtual network must be in the same region as the resource. For other services, the virtual network can be in any region, and in a different subscription (some services also across Microsoft Entra tenants).
- When the endpoint turns on, the subnet's source address for service traffic changes from a public IPv4 to its private IPv4. Open TCP connections to the service close. Firewall rules on the service that use Azure public IPs stop working. Plan a quiet window.
- DNS for the service does not change and still resolves to its public IP.
- Permissions: write access to the virtual network configures the endpoint. Securing a service to the subnet needs
Microsoft.Network/virtualNetworks/subnets/joinViaServiceEndpoint/actionon the subnet. - Managed disk traffic from VMs is not affected by Storage endpoint routing.
Service endpoint policies
A service endpoint policy filters egress traffic over service endpoints to specific Azure Storage accounts. It stops data exfiltration to other accounts. NSG service tags only restrict by region, so they still allow any account in that region.
| Item | Rule |
|---|---|
| Service | Azure Storage (generally available in all global regions) |
| Applied to | A subnet that already has the Microsoft.Storage service endpoint |
| Scope of an entry | A subscription, a resource group, or one storage account (resource ID) |
| No policy on the subnet | All storage accounts are reachable |
| Policy attached | Only listed accounts; everything else is denied (allow policy) |
| Multiple policies | Allowed on one subnet; traffic to resources in any of them is allowed |
| Endpoint scope | Becomes global when a policy is applied |
- Policies and the virtual network must be in the same region and subscription. Storage accounts can be in other subscriptions or tenants.
- Classic storage accounts and managed storage accounts are not supported: the policy denies them by default.
- Managed Azure services in the subnet are not supported, except Azure SQL Managed Instance. Remove them from the subnet first.
- If the primary account is listed, its RA-GRS secondary is allowed automatically.
- A policy covers only traffic from its subnets. For peered networks, apply the policy to each. It does not apply to on-premises traffic.
- There is no centralized logging for policies. Check storage logs, NSG flow logs and diagnostics.
- Limits per policy and per subnet or virtual network are listed in the numbers table. Policies cost nothing extra.
Access and verification
- Secured resources are not reachable from on-premises. Allow the public (NAT) IP addresses of your on-premises network or ExpressRoute Microsoft peering in the service IP firewall.
- NSGs allow outbound internet and Azure service traffic by default, which works with endpoints. To block internet but allow specific Azure services, use service tags in NSG rules.
- To filter traffic to Azure services, put an NVA in a subnet with the endpoint and secure the service only to that subnet.
- Verify: the service diagnostics show the client's virtual network private IP as source; effective routes show a more specific route with next hop type
VirtualNetworkServiceEndpoint. - Service endpoint routes override BGP and user-defined routes for the matching Azure service prefixes.
CLI and PowerShell
| Task | Azure CLI | PowerShell |
|---|---|---|
| Add a subnet with a Storage service endpoint | az network vnet subnet create --vnet-name vnet-1 --resource-group test-rg --name subnet-1 --address-prefix 10.0.0.0/24 --service-endpoints Microsoft.Storage | Add-AzVirtualNetworkSubnetConfig @subnet |
| Deny public access to a storage account by default | az storage account update --name $storageAcctName1 --resource-group test-rg --default-action Deny | - |
| Allow a subnet in the storage firewall | az storage account network-rule add --resource-group test-rg --account-name $storageAcctName1 --vnet-name vnet-1 --subnet subnet-1 | Add-AzStorageAccountNetworkRule @networkRuleParams1 |
| Create a service endpoint policy | az network service-endpoint policy create --resource-group test-rg --name service-endpoint-policy --location westus2 | New-AzServiceEndpointPolicy @sepolicyParams |
| Add a policy definition | az network service-endpoint policy-definition create --resource-group test-rg --policy-name service-endpoint-policy --name policy-definition --service "Microsoft.Storage" --service-resources $serviceResourceId | New-AzServiceEndpointPolicyDefinition @policyDefinitionParams |
| Associate the policy with a subnet | az network vnet subnet update --vnet-name vnet-1 --resource-group test-rg --name subnet-1 --service-endpoints Microsoft.Storage --service-endpoint-policy service-endpoint-policy | Set-AzVirtualNetworkSubnetConfig @subnetConfigParams |
Exam Tips
Tick each tip once you can answer it without looking.
“Secure a PaaS service to a subnet, no extra cost, no private IP or DNS changes” → Service endpoint plus a virtual network rule. Trap: a private endpoint adds a private IP and DNS changes.
“Microsoft's recommended way to reach Azure PaaS privately” → Private Link and private endpoints. Trap: service endpoints keep the service on its public IP.
“On-premises clients must reach a storage account secured with service endpoints” → Allow the on-premises public or NAT IPs in the storage firewall. Trap: service endpoints cannot be used for on-premises traffic.
“Use a service endpoint for a service in a subnet” → Enable it per service, per subnet. Trap: enabling at the virtual network level.
“Enable an endpoint on a busy subnet” → Expect open TCP connections to the service to close. Trap: the switch from public to private source IP drops them.
“Storage firewall allows an Azure public IP; breaks after the endpoint is enabled” → The source IP is now the private address; use a virtual network rule. Trap: IP rules for Azure public IPs stop working.
“Restrict a subnet to only specific storage accounts” → Service endpoint policy. Trap: NSG service tags allow every account in the region.
“Which service do service endpoint policies cover?” → Azure Storage. Trap: assuming SQL or Key Vault.
“Policy attached; a classic storage account stops working” → Classic accounts are denied by default; policies need Resource Manager accounts. Trap: adding the account ID to the policy.
“Subnet with no service endpoint policy” → All storage accounts are reachable. Trap: a policy applies only once attached.
“Subnet has several service endpoint policies” → Traffic to resources in any of them is allowed; the rest is denied. Trap: a resource is allowed if any one attached policy lists it.
“Policy for peered virtual networks” → Apply the policy to each virtual network's subnet. Trap: it does not follow peering.
“Policy must be in a different region than the virtual network” → Not supported: same region and subscription. Trap: cross-region policies.
“Azure SQL Database with a service endpoint” → Virtual network must be in the same region as the resource. Trap: other services allow any region.
“Check that the endpoint is in effect” → Effective routes show next hop VirtualNetworkServiceEndpoint; service logs show the private source IP. Trap: checking DNS: it still returns a public IP.
“Who may secure a service to a subnet?” → Needs joinViaServiceEndpoint/action on the subnet. Trap: write access to the virtual network alone covers only configuring the endpoint.
Sources
- Virtual network service endpoints
- Virtual network service endpoint policies
- Create and associate service endpoint policies
- Tutorial: Restrict access to PaaS resources with service endpoints
- What is Azure Private Link?
- What is a private endpoint?
Checked against Microsoft Learn on November 13, 2026.