Azure Storage - Firewall and Endpoints usage - azure

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.

Related

Serve public images from Blob Storage via Private Link

I see that I can do this with Azure Front Door Premium (CDN).
Azure Front Door can securely access the Storage Account via the private link while not exposing the Storage Account to the public internet, works great and very secure.
The issue is the price of Azure Front Door Premium, $330 per month minimum.
Other flavors of Azure Front door can't use the private link
Is there a more affordable way to securely connect via Private Link and serve images to public from Blob Storage? Or is Azure Front Door premium the only option?
• You surely can serve public images from Blob Storage via the private link through the private endpoint created but when accessed from the public internet, i.e., from outside the virtual network where the storage account’s private endpoint is not assigned a private IP address from the virtual network in which the private link is created. Kindly refer to the below point for more details: -
When you resolve the storage endpoint URL from outside the VNet with the private endpoint, it resolves to the public endpoint of the storage service. When resolved from the VNet hosting the private endpoint, the storage endpoint URL resolves to the private endpoint's IP address.
Please find the below steps for demonstrating the above stated point wherein you can serve public images from an Azure blob storage through a private endpoint: -
• For accessing a storage account through the private endpoint configured, kindly ensure that the DNS records for the storage account should be configured as below wherein the custom domain name through which the storage account’s public endpoint is accessible should be configured as below: -
Once, the custom domain name is configured, its related DNS records should be created as below for ensuring that the accessibility from inside the virtual network to the storage account through the private link created is possible. Also, create DNS records as below for that purpose: -
Thus, in this way, configuring the correct DNS records and allowing specific services access over Microsoft’s trusted network to the private endpoint created for the storage account can be very helpful in configuring the public access to the blob storage for accessing the images stored on it.
Please find the below links for more relevant information on this: -
https://learn.microsoft.com/en-us/azure/storage/common/storage-private-endpoints
https://learn.microsoft.com/en-us/azure/storage/files/storage-files-networking-endpoints?tabs=azure-portal

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

Azure connecting to a Storage Blob as Private IP instead of Public IP

I am connecting to a client FTP Storage blob via FTP in Azure from a managed Azure VM. I want to force the VM's public IP to be used but it is forcing the Private IP connect, this can be seen from the client logs. What do i need to configure to force the use of the public IP?
Basically the vm from where you are trying to connect to and your
storage account need to be part of same Virtual Network and Subnet.
Check if the firewall is blocking and disable the firewall on the blob
storage .
Also check in your case if both vm and azure storage are in same region:
Services deployed in the same region as the storage account use private Azure IP addresses for communication.i.e; your VM uses the
internal network (over ipv6 and not the VMs published IP addresses
)to attempt to access the Storage so adding the public IP won't work
as IP network rules have no effect on requests originating from the
same Azure region as the storage account
Thus, you cannot restrict access to specific Azure services based on
their public outbound IP address range.Reference: Configure Azure
Storage firewalls and virtual networks | Microsoft Docs.
To allow same-region requests try to use Virtual network rules .
One way to try is by adding the Virtual Network subnet of the VM to
the firewall rules and adding Azure.Storage as service endpoint to
the subnet. If added through Azure Portal the service
endpoint will be automatically added .
Please check the references:
Allowing azure storage connectivity to a public IP - Microsoft Q&A
networking - Cannot to Azure blob storage from VM because of firewall - Stack Overflow

Is there a way to prefer Azure Service Endpoint over Private Endpoint?

Scenario:
I have a hub & spoke architecture with Azure Firewall, which acts as my DNS server to VNets in all spokes. I also have a VPN connection, which I use to transfer data to my Azure Data Lake Storage Gen2. For that I use Private Endpoint, which is configured with Private DNS Zone associated with a Hub network.
So for - all great, all my traffic is secure, wherever I connect to my ADLS Gen2 from premises or from Databricks in Azure.
Now here's the problem. It costs a lot of money since Azure Private Endpoints charges you for inbound and outbound traffic.
So the question is, is there away to tell my Databricks nodes to use Service Endpoint (which is free) rather than Private Endpoint since Azure Firewall DNS always returns a private IP for my ADLS? I still need to keep Private Endpoint to be able to securely connect from my premises.
• Though you cannot create a service endpoint directly for the Azure Databricks workspace to transfer data from the Azure Data Lake Storage Gen 2 to it, but you can surely connect your Azure Databricks workspace to your on-premises network through the transit virtual network gateway created in the virtual network where your Azure Databricks workspace is peered. For that purpose, you will have to set up Azure virtual network gateway in the virtual network in which ADLS Gen2 has been deployed.
• Once the above said has been done, peer the virtual networks in which the private endpoint is configured and the one where ADLS Gen2 storage account is configured such that the Azure Databricks workspace is able to create a virtual network peering with the virtual network where Service endpoint for the Microsoft storage account is configured.
• Then configure the user defined routes and associate them with your Azure Databricks virtual network subnets and validate the setup. Kindly refer to the network diagram below for more clarification: -
For more information, kindly refer to the documentation link below: -
https://learn.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/on-prem-network

How can I connect an existing Azure storage account to a private link?

The Azure Security Centre is great at highlighting security issues, but not so great at helping you remediate them. For example, it tells me that I should connect a Storage Account to a Private Link, but the manual remediation points me to creating the link when creating the Storage Account, so, useless for existing ones. Can it be done, and if so how?
As #Sujit Singh's comment, to connect a Storage Account to a Private Link, you need to create private endpoints for your Azure Storage accounts in your Azure virtual network (VNet). This allows clients on a VNet to securely access data over a Private Link.
The private endpoint uses an IP address from the VNet address space
for your storage account service. Network traffic between the clients
on the VNet and the storage account traverses over the VNet and a
private link on the Microsoft backbone network, eliminating exposure
from the public internet.
For an existing storage account, you can add a private endpoint from storage account ---> networking ---> private endpoint connections ---> private endpoint.
For more detailed information on creating a private endpoint for your storage account, refer to the following articles:
Connect privately to a storage account from the Storage Account experience in the Azure portal
Create a private endpoint using the Private Link Center in the Azure portal
Create a private endpoint using Azure CLI
Create a private endpoint using Azure PowerShell

Resources