Azure - difference between service endpoint and private endpoint in simple terms - azure

I am not able to understand the difference between service endpoints and private endpoints clearly.
Need help preferably with an example.

You might have seen this in the Private Link FAQ:
Private Endpoints grant network access to specific resources behind a given service providing granular segmentation. Traffic can reach the service resource from on premises without using public endpoints.
A Service Endpoint remains a publicly routable IP address. A Private Endpoint is a private IP in the address space of the virtual network where the private endpoint is configured.
For simplicity, let's take the view of a VM in a VNET connecting to a storage account in the same subscription and same Azure region. There are three ways to connect.
Default
By default all traffic goes against the public endpoint of the storage account. Source IP of the traffic is the Public IP of the VM.
Service Endpoints
Traffic is still directed against the public endpoint of the storage account but the source IP has changed to the private IP of the VM. In fact, the traffic is also using the VNET and Subnet as source in the network dataframe.
Private Endpoints
The PaaS service now gets a virtual network interface inside the subnet and traffic from the VM to the storage account is now directed against the private IP address.
By far the best collection of useful information around Private Link that I have seen on the web is in this repository: https://github.com/dmauser/PrivateLink
You can also find some examples here: https://jeffbrown.tech/azure-private-service-endpoint/

Related

Multiple instances of SAME service to be accessed from vnet/subnet using Private vs Service Endpoint

When we have a requirement to connect to 2 different storage accounts (SAME service ie Azure Storage / 2 instances) from a VNET/Subnet,
Using-
1.Private Endpoints implies that we need one Private Endpoint for each storage account.
(And single private endpoint can be used across subnets in the vnet)
2.Service Endpoints implies that a SINGLE Service Endpoint is created for STORAGE SERVICE as a whole and it gets re used for different storage accounts.
(And each subnet needing access to storage accounts would need its own service endpoint)
Would this inference be correct?
Regards,
Aditya Garg
What you mentioned is the correct, however, there are more differences and use-case for both these services. One of the major difference I would say is
Private Endpoints grant network access to specific resources behind a given service providing granular segmentation. Traffic can reach the service resource from on-premises without using public endpoints.
A Service Endpoint remains a publicly routable IP address. A Private Endpoint is a private IP in the address space of the virtual network where the private endpoint is configured.
One should also need to know their limitations
Service endpoint limitation
Private endpoint limitation
Some other reference

Is it necessary to create a private DNS zone for private endpoints to PaaS services in Azure?

Right now I'm creating some private endpoints for a number of Azure Storage services. There are two storage accounts, for the first I create a blob endpoint and a queue endpoint. For the second account I create a blob endpoint and a dfs endpoint.
When I try connecting to the endpoints from a machine outside of the VNET using the regular connection strings (that now point to the privatelink resources), I seem to not be able to reach the resource as expected. Trying to connect to it from a VM and an AKS cluster within the same VNET as the private endpoints, I am able to connect.
If these are basically my only use cases, and I'm ok using the default names to connect to the private endpoint resources, is it OK to not create a private DNS zone?
It is a bit unclear to me from the documentation whether this is a necessity.
By using private link you create an endpoint into your vnet/subnet. The private DNS is linked to your vnet and allows you to direct the traffic to that private endpoint (e.g. 10.1.0.4) by using the storage domain.
It's not nessecary to have that private DNS. But that means you'll need to connect directly to private ip address of that endpoint. While that is technically possible you'll likely run into some issues such as the server not knowing which domain is requested without host header and issues with the SSL certificate.
I would therefore recommended always using the private DNS.

ExpressRoute - Private Peering - Storage Account Firewall

Have a storage account that I need to enable the firewall on. I've already put in place private endpoints and create the necessary Private DNS domains to allow privatelink.blob.core.windows.net to work correctly (on-premises requests resolve to the correct RFC1918 address). The issue I have is with locking down the storage account.
I am unable to specify the on-prem IP ranges since they are RFC1918 addresses. The only way I can see to allow access is via VNet/Subnet or via an explicit public IP address. I've read a bit about using the NAT address of the ExpressRoute but that seems to only pertain to Microsoft or public peering. There shouldn't be any NAT happening.
For reference. The ER is terminating into a hub and the VNet where the storage endpoint is located is peered with this hub.
Thanks,
Nathan
Network Security Group (NSG) support for private endpoints is in public preview. (Preview features do not have the same SLA's as generally available features and are not recommended for production.) Depending on your region, you may be able to use this feature: https://azure.microsoft.com/en-us/updates/public-preview-of-private-link-network-security-group-support/
An NSG could be associated with each subnet that contains a private endpoint to the storage account. An inbound rule could then be added to the NSG that allows traffic from the on-premises IP's to the private endpoint IP's.
Maybe it's too late for the answer, but you need a DNS conditional forward for the onprem workloads to work with private endpoints. If you don't use it, you will always resolve the query to the public endpoint instead of the private one.
https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns

Azure App service not accessible with private endpoint within APIM/VM

I have configured my app serivce to be part of a subnet within a VNET.
Now i have integrated my app service with a private endpoint within the same VNET.
With the private endpoint integration, i'm now not able to access the app service (i.e. my API) on a public internet, where i'm getting 403 forbidden error. Which is an expected behaviour to restrict the access on the public network
But the issue is, i want to expose this API via APIM (which is internal) configured within a separate subnet in the same VNET, but i'm not not access the API now with the private endpoint IP address. I was hoping that the resources with in the VNET will be able to reach the App service using its private IP address
I also tried to configure a VM in a separate subnet with in the same VNET, but when i ping the API private IP from the VM, i'm getting request timedout.
Current there have not been any rules setup with NSG to restrict the subnets to talk between each other.
Please let me know how to expose the API with private endpoint via APIM which is also configured to be only internal
You also need to configure private dns zone as now your app's FQDN needs to be resolved to the private IP, instead of a public one.
https://learn.microsoft.com/en-us/azure/private-link/create-private-endpoint-powershell
Update:
Just want to add that app service cannot be accessed via the IP as it is assigned to the app service plan, which can be shared by other app services. The FQDN is required for app service plan to do L7 routing

Azure Storage - Firewall and Endpoints usage

I have recently come across the Private Endpoint feature in Azure Storage and trying to implement it for secure access from a VNet. However, I am getting access issues while using Firewall, Virtual Network Service Endpoint and Private Endpoint all together.
I have two VNets (VNet1 & VNet2) in my subscription and an on-premises machine with Public IP to connect to Azure Storage. Following is my setup.
VNet1 with a Subnet enabled with Service Endpoint feature is whitelisted in Storage account firewall.
Next, I have created a Private Endpoint to this storage account (for blob service) from VNet2 which is also hosted inside the same Vnet.
Finally, I have whitelisted the Public IP of my on-premises VM to connect to the storage account under Firewall section.
Given the above setup, when I am trying to access this storage account blob containers inside a VM placed under VNet2, I am getting authorization issues.
May I please check if this setup is valid? Do Private Endpoint and Service Endpoint features work in Parallel?
Yes, private endpoints can be created in subnets that use Service Endpoints. Clients in a subnet can thus connect to one storage account using private endpoint, while using service endpoints to access others.
There are multiple ways to connect to storage account:
Using a private endpoint (private link) to connect to storage account: Please find the referred document here.
Using Service Endpoint and Private endpoint: Please find the referred document here.
You can find more details in this public document.

Resources