Forum Discussion
Elvir Karic
Jan 07, 2021Copper Contributor
ARM Template for Virtual WAN Network Connection
Has anyone successfully created ARM Template to automate VNET Connection among VWANHub and spoke VNET. I have Subs A where my VWAN and Sub B where my spoke VNET is located. I have template that works...
azharamir13
May 15, 2023Brass Contributor
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualWanName": {
"type": "string",
"metadata": {
"description": "The name of the Virtual WAN."
}
},
"virtualWanLocation": {
"type": "string",
"metadata": {
"description": "The location of the Virtual WAN."
}
},
"vnetName1": {
"type": "string",
"metadata": {
"description": "The name of the first VNET to connect to the VWAN."
}
},
"vnetName2": {
"type": "string",
"metadata": {
"description": "The name of the second VNET to connect to the VWAN."
}
},
"vnet1ResourceId": {
"type": "string",
"metadata": {
"description": "The resource ID of the first VNET to connect to the VWAN."
}
},
"vnet2ResourceId": {
"type": "string",
"metadata": {
"description": "The resource ID of the second VNET to connect to the VWAN."
}
}
},
"resources": [
{
"type": "Microsoft.Network/virtualWans",
"apiVersion": "2021-02-01",
"name": "[parameters('virtualWanName')]",
"location": "[parameters('virtualWanLocation')]",
"properties": {
"type": "Basic",
"vpnSites": [],
"securityProviderName": "TrustedSecurityPartner",
"disableVpnEncryption": false
},
"resources": [
{
"type": "virtualHubs",
"apiVersion": "2021-02-01",
"name": "hub1",
"location": "[parameters('virtualWanLocation')]",
"dependsOn": [
"[concat('Microsoft.Network/virtualWans/', parameters('virtualWanName'))]"
],
"properties": {
"addressPrefix": "10.0.0.0/24",
"virtualNetworkConnections": [
{
"name": "connection1",
"properties": {
"remoteVirtualNetwork": {
"id": "[parameters('vnet1ResourceId')]"
},
"connectionType": "Vnet2Vnet",
"routingWeight": 10,
"sharedKey": "mysharedkey"
}
},
{
"name": "connection2",
"properties": {
"remoteVirtualNetwork": {
"id": "[parameters('vnet2ResourceId')]"
},
"connectionType": "Vnet2Vnet",
"routingWeight": 10,
"sharedKey": "mysharedkey"
}
}
]
}
}
]
}
]
}
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualWanName": {
"type": "string",
"metadata": {
"description": "The name of the Virtual WAN."
}
},
"virtualWanLocation": {
"type": "string",
"metadata": {
"description": "The location of the Virtual WAN."
}
},
"vnetName1": {
"type": "string",
"metadata": {
"description": "The name of the first VNET to connect to the VWAN."
}
},
"vnetName2": {
"type": "string",
"metadata": {
"description": "The name of the second VNET to connect to the VWAN."
}
},
"vnet1ResourceId": {
"type": "string",
"metadata": {
"description": "The resource ID of the first VNET to connect to the VWAN."
}
},
"vnet2ResourceId": {
"type": "string",
"metadata": {
"description": "The resource ID of the second VNET to connect to the VWAN."
}
}
},
"resources": [
{
"type": "Microsoft.Network/virtualWans",
"apiVersion": "2021-02-01",
"name": "[parameters('virtualWanName')]",
"location": "[parameters('virtualWanLocation')]",
"properties": {
"type": "Basic",
"vpnSites": [],
"securityProviderName": "TrustedSecurityPartner",
"disableVpnEncryption": false
},
"resources": [
{
"type": "virtualHubs",
"apiVersion": "2021-02-01",
"name": "hub1",
"location": "[parameters('virtualWanLocation')]",
"dependsOn": [
"[concat('Microsoft.Network/virtualWans/', parameters('virtualWanName'))]"
],
"properties": {
"addressPrefix": "10.0.0.0/24",
"virtualNetworkConnections": [
{
"name": "connection1",
"properties": {
"remoteVirtualNetwork": {
"id": "[parameters('vnet1ResourceId')]"
},
"connectionType": "Vnet2Vnet",
"routingWeight": 10,
"sharedKey": "mysharedkey"
}
},
{
"name": "connection2",
"properties": {
"remoteVirtualNetwork": {
"id": "[parameters('vnet2ResourceId')]"
},
"connectionType": "Vnet2Vnet",
"routingWeight": 10,
"sharedKey": "mysharedkey"
}
}
]
}
}
]
}
]
}