question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to create VPN Client configuration

See original GitHub issue

Hello, i’m trying to build a virtual network gateway with the vpn_client_configuration parameters.

Here’s an example of my code:

virtual_network_gateway = network_client.virtual_network_gateways.begin_create_or_update(
    GROUP_NAME,
    VIRTUAL_NETWORK_GATEWAY,
        {
        "ip_configurations": [
        {
            "private_ip_allocation_method": "Dynamic",
            "subnet": {
            "id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + GROUP_NAME + "/providers/Microsoft.Network/virtualNetworks/" + VIRTUAL_NETWORK_NAME + "/subnets/" + SUBNET + ""
            },
            "public_ip_address": {
            "id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + GROUP_NAME + "/providers/Microsoft.Network/publicIPAddresses/" + PUBLIC_IP_ADDRESS_NAME + ""
            },
            "name": IP_CONFIGURATION_NAME
        }
        ],
            "gateway_type": "Vpn",
            "vpn_type": "RouteBased",
            "enable_bgp": False,
            "active_active": False,
            "enable_dns_forwarding": False,
            "sku": {
            "name": "VpnGw1",
            "tier": "VpnGw1",
            },

            "vpn_client_configuration" : {
            "vpn_client_address_pool" : {
            "address_prefix" : ["192.168.0.0/24"]
            },
            "vpn_client_root_certificates " : [
            {   
            "name" : "testCA",
            "public_cert_data" : ROOT_CERT
            }
            ],
            "vpn_client_protocols" : [
            "OpenVPN"
            ]
            },
            "vpn_gateway_generation" : "Generation1",
            "location": "westeurope"

    }
).result()

It creates the virtual netwok gateway with all of the information except the client configuration!

Screenshot 2022-02-10 at 16 07 32

I couldn’t find any samples so i’m not sure if the issue is the syntax, but i followed this document:

https://docs.microsoft.com/en-us/python/api/azure-mgmt-network/azure.mgmt.network.v2020_04_01.models.vpnclientconfiguration?view=azure-python

Thanks for the help!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Wzb123456789commented, Feb 17, 2022

@MPereira95 For more complex parameters, we prefer to use model to pass parameters. The following is the parameter model that I have tried to successfully create a virtual gateway.

vn_para = VirtualNetworkGateway(
    ip_configurations=[VirtualNetworkGatewayIPConfiguration(
        private_ip_allocation_method="Dynamic",
        subnet=SubResource(
            id="/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + GROUP_NAME + "/providers/Microsoft.Network/virtualNetworks/" + VIRTUAL_NETWORK_NAME + "/subnets/" + SUBNET + ""),
        public_ip_address=SubResource(
            id="/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + GROUP_NAME + "/providers/Microsoft.Network/publicIPAddresses/" + PUBLIC_IP_ADDRESS_NAME + ""),
        name=IP_CONFIGURATION_NAME
    )],
    gateway_type="Vpn",
    vpn_type="RouteBased",
    enable_bgp=False,
    active=False,
    enable_dns_forwarding=False,
    sku=VirtualNetworkGatewaySku(name="VpnGw2", tier="VpnGw2"),
    vpn_client_configuration=VpnClientConfiguration(
        vpn_client_address_pool=AddressSpace(address_prefixes=["192.168.0.0/24"]),
        vpn_authentication_types=['Certificate'],
        vpn_client_root_certificates=[VpnClientRootCertificate(name="testCA", public_cert_data=ROOT_CERT)],
        vpn_client_protocols=["OpenVPN"],
    ),
    vpn_gateway_generation="Generation2",
    location="westus"
)
0reactions
MPereira95commented, Feb 17, 2022

@Wzb123456789 Thank you! This solved my problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix the four biggest problems with failed VPN connections
1: The VPN connection is rejected. · Networking: Must-read coverage · 2: An unauthorized connection is accepted. · 3: Locations beyond the VPN ......
Read more >
Unable to establish the VPN connection , VPN server may be ...
This video will guided you on on Forticlient error " unable to establish the VPN connection connection , VPN server may be unreachable...
Read more >
Can't setup VPN on Windows 10 Pro - Microsoft Community
1. Click on Start icon. · 2. Type Control Panel and press Enter. · 3. Click on Network and Sharing Center. · 4....
Read more >
Unable to create a VPN Connection on Windows 10
A friend called me up recently to ask for help with a Windows laptop. It had been running Windows 8.1 and auto upgraded...
Read more >
"the vpn client agent was unable to create the client host ...
"the vpn client agent was unable to create the client host configuration manager" - can't access the GUI to collect the DART info...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found