Public/Deploy/IaaS/vpngw/New-CmAzIaasVpnGw.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "Location": { "defaultValue": "[resourceGroup().location]", "type": "String", "metadata": { "description": "location" } }, "VpnGwsSecureObject": { "type": "SecureObject", "metadata": { "description": "vpn object to with all required parameters" } } }, "resources": [ { "type": "Microsoft.Resources/Deployments", "apiVersion": "2019-10-01", "name": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].templateName]", "copy": { "name": "vpnGatewayCopy", "count": "[length(parameters('VpnGwsSecureObject').vpnGws)]" }, "properties": { "mode": "Incremental", "expressionEvaluationOptions": { "scope": "outer" }, "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { }, "resources": [ { "condition": "[not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].GatewaySubnetPrefix))]", "type": "Microsoft.Network/virtualNetworks/subnets", "apiVersion": "2019-04-01", "name": "[concat(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].virtualNetworkName, '/', 'GatewaySubnet')]", "location": "[parameters('Location')]", "properties": { "addressPrefix": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].GatewaySubnetPrefix]" } }, { "apiVersion": "2019-04-01", "type": "Microsoft.Network/publicIPAddresses", "name": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].GatewayPublicIPName]", "location": "[parameters('Location')]", "properties": { "publicIPAllocationMethod": "Dynamic" }, "tags": { "cm-service": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].service.publish.publicIp]" } }, { "apiVersion": "2019-04-01", "type": "Microsoft.Network/virtualNetworkGateways", "name": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].GatewayName]", "location": "[parameters('Location')]", "dependsOn": [ "[concat('Microsoft.Network/publicIPAddresses/', parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].GatewayPublicIPName)]" ], "tags": { "cm-service": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].service.publish.virtualNetworkGateway]" }, "properties": { "ipConfigurations": [ { "properties": { "privateIPAllocationMethod": "Dynamic", "subnet": { "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].virtualNetworkName, 'GatewaySubnet')]" }, "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].GatewayPublicIPName)]" } }, "name": "vnetGatewayConfig" } ], "sku": { "name": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].Sku]", "tier": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].Sku]" }, "gatewayType": "Vpn", "vpnType": "RouteBased", "enableBgp": false, "vpnClientConfiguration": { "vpnClientAddressPool": { "addressPrefixes": [ "[if(and(not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.VpnAddressPool)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.RootCertificateName)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.clientRootCertData))), parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.VpnAddressPool, json('null'))]" ] }, "vpnClientRootCertificates": [ { "name": "[if(and(not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.VpnAddressPool)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.RootCertificateName)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.clientRootCertData))), parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.RootCertificateName, json('null'))]", "properties": { "publicCertData": "[if(and(not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.VpnAddressPool)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.RootCertificateName)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.clientRootCertData))), parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].P2s.clientRootCertData, json('null'))]" } } ] } } }, { "apiVersion": "2019-04-01", "condition": "[and(not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.cidrBlocks)), not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.clientSitePublicIP)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.SharedKey)))]", "type": "Microsoft.Network/localNetworkGateways", "name": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.localGatewayName]", "location": "[parameters('Location')]", "tags": { "cm-service": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].service.publish.localNetworkGateway]" }, "properties": { "localNetworkAddressSpace": { "addressPrefixes": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.cidrBlocks]" }, "gatewayIpAddress": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.clientSitePublicIP]" } }, { "apiVersion": "2019-04-01", "condition": "[and(not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.cidrBlocks)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.clientSitePublicIP)),not(empty(parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.SharedKey)))]", "name": "[Concat('Connections-', parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.localGatewayName)]", "type": "Microsoft.Network/connections", "location": "[parameters('Location')]", "dependsOn": [ "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].GatewayName)]", "[resourceId('Microsoft.Network/localNetworkGateways', parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.localGatewayName)]" ], "properties": { "virtualNetworkGateway1": { "id": "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].GatewayName)]" }, "localNetworkGateway2": { "id": "[resourceId('Microsoft.Network/localNetworkGateways', parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.localGatewayName)]" }, "connectionType": "IPsec", "routingWeight": 10, "sharedKey": "[parameters('VpnGwsSecureObject').vpnGws[copyIndex('vpnGatewayCopy')].S2s.SharedKey]" } } ] } } } ], "outputs": { } } |