How to connect to Azure Key Vault using P2S VPN?

Fabien Graf 25 Reputation points
2023-02-09T11:31:36.2833333+00:00

I'm trying to limit external access to resources within a specific VNet to a number of users connecting to an Azure VPN Gateway via P2S VPN.

I have setup a VNet with two address spaces:
10.10.0.0/16

10.110.0.0/16

I setup two subnets, namely one for the resources (adress space 10.10.0.0/16) and the required GatewaySubnet (adress space 10.110.0.0/16).

I also setup a key vault with access limited to the two subnets mentioned above.

Now I setup a VPN gateway using the mentioned GatewaySubnet, expecting to be able to give users connecting via P2S VPN an address within the GatewaySubnet address space (so they can access key vault via VPN). However, when trying to set the address pool of the Point-to-site configuration within the GatewaySubnet I get an error because of overlapping address ranges. My assumption to this point was that they actually MUST overlap, since I specifically reserved the GatewaySubnet address spaces for the gateway. So how do I get the connecting VPN participants an IP address within the ranges of my recognized subnets so that Azure Key Vault allows them to connect?

TLDR: How can I give devices connecting to my Azure VPN gateway via P2S connection a valid address within a recognized subnet of my vnet?

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,448 questions
Azure VPN Gateway
Azure VPN Gateway
An Azure service that enables the connection of on-premises networks to Azure through site-to-site virtual private networks.
1,786 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,762 questions
0 comments No comments
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 49,536 Reputation points Microsoft Employee Moderator
    2023-02-09T13:12:11.7933333+00:00

    @Fabien Graf

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    I understand that you have created a VPN Gateway to establish P2S Connections from remote users to access Azure Key Vault.

    I am afraid your understanding of how P2S Connection works is incorrect.

    The remote users will not get an IP Address from the Gateway Subnet Address range.

    Rather, you have to specifically mention an address Pool for the VPN Gateway to allocate IP Addresses to the remote users.

    Refer: Client address pool .

    User's image

    P.S :

    • Make sure you do not have any overlapping address range with the VNet's address space.
    • This additional range, automatically becomes a part of the Azure VNet traffic (i.e. recognized address range)
    • It is not required to allocate a /16 address range to a GatewaySubnet. A /24 would suffice.

    Now, creating a P2S VPN Gateway alone does not enable connectivity between remote users and Azure Key Vault (or any other PaaS Service for that matter)

    You have to create a Private Endpoint for the KeyVault

    And access the keyVault via the Private Endpoint.

    Thanks,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.


2 additional answers

Sort by: Most helpful
  1. Bas Pruijn 956 Reputation points
    2023-02-10T16:34:40.4366667+00:00

    Great that you were able to connect to the VPN Gateway using a P2S connection. In order to access PaaS services there are a couple of actions to take:

    This combination will tell your PC to use the Azure DNS forwarder as the preferred DNS provider. The Azure DNS forwarder then is able to ask the Azure DNS for the private IP address of the keyvault, as registered in the private DNS zone. Then, you can access the keyvault using your own network, instead of via the internet.


  2. msrini-MSFT 9,291 Reputation points Microsoft Employee
    2023-02-10T19:18:35.9866667+00:00

    Hi,

    How can I give devices connecting to my Azure VPN gateway via P2S connection a valid address within a recognized subnet of my vnet? --> This doesn't need to be an IP block from your VNET. This needs to be unique. You can specify a unique CIDR block and check if that works.

    Regards,

    Karthik Srinivas

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.