Cross-subscription Private Endpoint in Azure - azure

Is it possible to use a Private endpoint between two services -
In different VNETs
VNETs are in different subscriptions and VNETs have not peered
Subscriptions are in different Tenant
On similar lines, it seems, Private Link could also support the same - Support for across VNET sharing. Extract below -
"
Privately access services on the Azure platform: Connect your virtual network to services in Azure without a public IP address at the source or destination. Service providers can render their services in their own virtual network and consumers can access those services in their local virtual network. The Private Link platform will handle the connectivity between the consumer and services over the Azure backbone network"
Regards,
Nitin

In this case, I don't think it's possible without VNet peered.
After my validation, we can access the service in different subscriptions and different tenants with private endpoint and VNet to VNet peering enabled in each VNet.
In subA and TenantA, I created
VNetA and one Azure VMa without public IP deployed in that VNet. We can access the VM with a bastion host in that VNet. Refer to this.
In subB and TenantB, I create
a storage account and a private DNS zone privatelink.file.core.windows.net and a VNetB.
Enable the private endpoint for this storage account and storage subresource file, you may refer to this
Note, we should link the VNetA and VNetB in the same private DNS zone, then we can get the file share FQDN resolved to the private IP address from the Azure VMa. Also, we should use an account having enough permission on both subscriptions.
If without the VNet peering, the network connecting is blocked because the VNet A and VNet B belong to different isolation virtual networks and there is no routing from VNet A and VNet B.
If the VNet peering at each other, the network connecting is successful.

It's perfectly possible, works Private Endpoints works just fine across subscriptions and tenants. You just need to create them slightly differently. Create them from the destination side, then on the Resource page select "Connect to an Azure resource by resource ID or alias.". And paste the resource id you are connecting to. Resource ID can be obtained on the resource overview page - JSon link.
One it's done - go to the source->private endpoints and manually approve requested private endpoint.

When selecting Connect to an Azure resource by resource ID or alias, what's not very clear are the actual values for Resource ID or alias(2) and Target sub-resource(3).
In this example, I am referencing a storage account and file share.
Resource ID or alias = Resource ID of the storage account. e.g:
/subscriptions/aaaaa-1111-11111-aaaa-asasdas212/resourceGroups/myresourcegroup/providers/Microsoft.Storage/storageAccounts/mystorageaccount
Target sub-resource is the name of the sub-resource from the following list:
Reference: https://learn.microsoft.com/en-us/azure/storage/common/storage-private-endpoints#dns-changes-for-private-endpoints

Related

Subnet Delegation and Service Endpoints for Azure SQL Database in a vnet?

If I am setting up an Azure SQL Database in a vnet which Azure App Service and Azure Function will access. Is using both Subnet Delegation and Service Endpoints the right way to go? I didn't fully understand the documentation.
Regarding subnet delegation, I read this Microsoft article and this stackoverflow post, which stated:
When you delegate a subnet to an Azure service, you allow that service to establish some basic network configuration rules for that subnet, which help the Azure service operate their instances in a stable manner.
That sounds like a good thing but makes me wonder how it worked efficiently w/o subnet delegation.
As for Service Endpoints, I read this Microsoft article, which states:
Virtual Network (VNet) service endpoint provides secure and direct connectivity to Azure services over an optimized route over the Azure backbone network. Endpoints allow you to secure your critical Azure service resources to only your virtual networks. Service Endpoints enables private IP addresses in the VNet to reach the endpoint of an Azure service without needing a public IP address on the VNet.
Does that mean I cannot reach the Azure SQL Database from my home machine w/a firewall rule?
They both sound like they have the same benefits and I'm struggling to understand the difference. I suppose the larger question is should I enable both for the simple architecture outlined above.
In the Microsoft service endpoints documentation they also mention:
Microsoft recommends use of Azure Private Link for secure and private access to services hosted on Azure platform. For more information, see Azure Private Link.
For some reason that seems like an Azure to on-premise thing.
• You cannot use a ‘Subnet Delegation’ along with a ‘Private endpoint’ since that subnet is delegated for the said service, in your case, the Azure SQL Database. Through a subnet delegation, you can define the NSG association for it, as well as associate multiple delegated subnets to a common NSG. You can also define the IP Address space for the delegated subnet, the route table association with it, the custom DNS entry configuration in Azure DNS as well as define the minimum number of IP Addresses available for that delegated subnet. Similarly, with regards to service endpoint, these stated functions are not available.
• In service endpoint, you do not have control over the routing mechanism as well as the IP address related allotment, reservation, or configuration. Also, managing DNS entries for the resources managed through them and controlling them through a firewall or NAT gateway isn’t required unlike a subnet delegation because all these things are managed by Microsoft Azure’s backbone network on your behalf.
Thus, both have their own features and specifications for enabling you to configure according to your own requirements.
Does that mean I cannot reach the Azure SQL Database from my home machine w/a firewall rule?
Yes, you will have to create a firewall rule to allow the access from on-premises system to Azure SQL Server/Database and configure the service endpoint accordingly to allow the VPN client IP Addresses for accessing the same over public internet.
Also, through Azure private link, you won’t be able to connect from on-premises to Azure as it uses a private IP address and a private DNS zone entry related to it to connect to Azure resources in the same virtual network.
To know more regarding the configuration of Azure service access from on-premises network, kindly refer to the below given link: -
https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-service-endpoints-overview#secure-azure-service-access-from-on-premises
Also, refer to the below snapshots regarding the configuration and selection of service endpoint for a particular subnet: -

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.

Using private endpoints across Azure Subscription

If the two VNETs are peered, can a client in one VNET sitting in one Azure Subscription use Private Endpoint to a resource in another VNET setting in separate Azure Subscription?
Essentially, I am asking if Private Endpoints can be used across Azure subscriptions?
Of course Yes. You can see the description here:
The private endpoint can be reached from the same virtual network,
regionally peered VNets, globally peered VNets and on premises using
private VPN or ExpressRoute connections.
From this, it means the private endpoint can be reached from the globally peered VNets. And here is also a description for the global peering of VNet:
The ability to transfer data between virtual networks across Azure
subscriptions, Azure Active Directory tenants, deployment models, and
Azure regions.
So finally, the conclusion according to the two descriptions is that the private endpoint can be accessed across different subscriptions.

Azure Storage Network Security Group

I want to add an Azure storage account to a VNet / Network Security Group but keep receiving an Authorisation Failure message.
The error was: 'code: AuthorizationFailure content: _CYCLIC_OBJECT_ message: This request is not authorized to perform this operation.
I've added the VNet to the storage account with the Microsoft.Storage service endpoint and the subnets have been associated with the NSG.
I've created an inbound rule for the IP addresses and an outbound rule using the storage service tag on the NSG.
I've even tried it with an all internet inbound rule but no joy.
If I whitelist the IP address in the Firewall and Virtual Network settings on the storage account then it works fine.
Is there something that I'm missing?
In your comment, you want to manage the firewall rule of storage account via associated it with a VNet and NSG. This's not in the right direction.
You can not use network security rules for Azure Storage Services because the storage account can not be inside a VNet or a part of a VNet and the NSG works at the IP address, port, protocol level. For more information, you could refer to this answer.
In addition, if you have added selected VNets in the Firewall and Virtual Network settings on the storage account, it grants access storage account from a virtual network. So only selected VNet could access your storage account. It will appear access deny from your corporate network if you don't add its external IP address in the firewall.
You may want to create Private Endpoints for your storage account, which assigns a private IP address from your VNet to the storage account, and secures all traffic between your VNet and the storage account over a private link. With this, You can also use the firewall to block all access through the public endpoint when using private endpoints. Please note that currently, you can't configure NSG rules and user-defined routes for private endpoints.

Azure Virtual Network Gateway - Access resources in other resource groups

Let's take the following scenario:
I have a resource group in the East Region with 1 VM
I have a resource group in the West Region with 1 VM
Both of these VMs are only accessible via Private IP addresses. RDP via Public IP address is not an option. One would assume that in order for me to RDP to these machines, I would have to VPN into Azure's gateway first. However, I don't want to create a virtual gateway in every single resource group.
Is it possible for me to vpn into one resource (in one resource group), and access all of the machines in all other resource groups?
Yes, It's possible to do this with VNet peering(connecting VNets within the same Azure region). You could follow this to implement a hub-spoke network topology in Azure. In this case, the hub VNet is a peering VNet with allow gateway transit enabled and the spoke VNet is a peering VNet with use remote gateways enabled.
please note that you cannot use remote gateways or allow gateway transit with global peering(connecting VNets across Azure regions). Refer to requirements and constraints about global peering.
To use remote gateways or allow gateway transit, peered virtual
networks in must be in the same region.
so you have to move the peering VNets in the same region if the two VNets in each resource group are not in the same region.
Another option will create a separate VPN gateway in another resource group but this is not your expectation. Note that
A Point-to-Site client can only connect to resources in the VNet in
which the virtual network gateway resides.
Refer to VPN gateway FAQ.
You can use vnet peering with Use remote gateways checkbox enabled. You need to peer the vnets together and check use remote gateways on the second vnet (one without gateway).
Reading:
https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/hybrid-networking/hub-spoke
https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-peering-overview

Resources