tests/functional/Microsoft.Network/connections/deploy/deploy.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "connectionName": {
            "type": "String"
        },
        "virtualNetworkName": {
            "type": "String"
        },
        "localNetworkGatewayName": {
            "type": "String"
        },
        "virtualNetworkGatewayName": {
            "type": "String"
        },
        "publicIPAddressesName": {
            "type": "String"
        }
    },
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Network/localNetworkGateways",
            "apiVersion": "2020-11-01",
            "name": "[parameters('localNetworkGatewayName')]",
            "location": "northeurope",
            "properties": {
                "localNetworkAddressSpace": {
                    "addressPrefixes": [
                        "192.168.1.0/24"
                    ]
                },
                "gatewayIpAddress": "8.8.8.8"
            }
        },
        {
            "type": "Microsoft.Network/publicIPAddresses",
            "apiVersion": "2020-11-01",
            "name": "[parameters('publicIPAddressesName')]",
            "location": "northeurope",
            "sku": {
                "name": "Standard",
                "tier": "Regional"
            },
            "properties": {
                "ipAddress": "20.219.217.108",
                "publicIPAddressVersion": "IPv4",
                "publicIPAllocationMethod": "Static",
                "idleTimeoutInMinutes": 4,
                "dnsSettings": {
                    "domainNameLabel": "[parameters('publicIPAddressesName')]",
                    "fqdn": "[concat(parameters('publicIPAddressesName'), '.northeurope.cloudapp.azure.com')]"
                },
                "ipTags": []
            }
        },
        {
            "type": "Microsoft.Network/virtualNetworks",
            "apiVersion": "2020-11-01",
            "name": "[parameters('virtualNetworkName')]",
            "location": "northeurope",
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        "10.1.0.0/24"
                    ]
                },
                "subnets": [
                    {
                        "name": "GatewaySubnet",
                        "properties": {
                            "addressPrefix": "10.1.0.0/26",
                            "delegations": [],
                            "privateEndpointNetworkPolicies": "Enabled",
                            "privateLinkServiceNetworkPolicies": "Enabled"
                        }
                    }
                ],
                "virtualNetworkPeerings": [],
                "enableDdosProtection": false
            }
        },
        {
            "type": "Microsoft.Network/virtualNetworks/subnets",
            "apiVersion": "2020-11-01",
            "name": "[concat(parameters('virtualNetworkName'), '/GatewaySubnet')]",
            "dependsOn": [
                "[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]"
            ],
            "properties": {
                "addressPrefix": "10.1.0.0/26",
                "delegations": [],
                "privateEndpointNetworkPolicies": "Enabled",
                "privateLinkServiceNetworkPolicies": "Enabled"
            }
        },
        {
            "type": "Microsoft.Network/connections",
            "apiVersion": "2020-11-01",
            "name": "[parameters('connectionName')]",
            "location": "northeurope",
            "dependsOn": [
                "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('virtualNetworkGatewayName'))]",
                "[resourceId('Microsoft.Network/localNetworkGateways', parameters('localNetworkGatewayName'))]"
            ],
            "properties": {
                "virtualNetworkGateway1": {
                    "id": "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('virtualNetworkGatewayName'))]"
                },
                "localNetworkGateway2": {
                    "id": "[resourceId('Microsoft.Network/localNetworkGateways', parameters('localNetworkGatewayName'))]"
                },
                "connectionType": "IPsec",
                "connectionProtocol": "IKEv2",
                "routingWeight": 0,
                "sharedKey": "rest1002",
                "enableBgp": false,
                "useLocalAzureIpAddress": false,
                "usePolicyBasedTrafficSelectors": false,
                "ipsecPolicies": [],
                "trafficSelectorPolicies": [],
                "expressRouteGatewayBypass": false,
                "dpdTimeoutSeconds": 0,
                "connectionMode": "Default"
            }
        },
        {
            "type": "Microsoft.Network/virtualNetworkGateways",
            "apiVersion": "2020-11-01",
            "name": "[parameters('virtualNetworkGatewayName')]",
            "location": "northeurope",
            "dependsOn": [
                "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddressesName'))]",
                "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), 'GatewaySubnet')]"
            ],
            "properties": {
                "enablePrivateIpAddress": false,
                "ipConfigurations": [
                    {
                        "name": "vNetGatewayConfig1",
                        "properties": {
                            "privateIPAllocationMethod": "Dynamic",
                            "publicIPAddress": {
                                "id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddressesName'))]"
                            },
                            "subnet": {
                                "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworkName'), 'GatewaySubnet')]"
                            }
                        }
                    }
                ],
                "sku": {
                    "name": "VpnGw3",
                    "tier": "VpnGw3"
                },
                "gatewayType": "Vpn",
                "vpnType": "RouteBased",
                "enableBgp": true,
                "activeActive": false,
                "bgpSettings": {
                    "asn": 65815,
                    "bgpPeeringAddress": "10.1.0.62",
                    "peerWeight": 0,
                    "bgpPeeringAddresses": [
                        {
                            "ipconfigurationId": "[concat(resourceId('Microsoft.Network/virtualNetworkGateways', parameters('virtualNetworkGatewayName')), '/ipConfigurations/vNetGatewayConfig1')]",
                            "customBgpIpAddresses": []
                        }
                    ]
                },
                "vpnGatewayGeneration": "Generation1"
            }
        }
    ]
}