Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
163 lines (160 sloc) 5.5 KB
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vnetName": {
"type": "string",
"metadata": {
"description": "VNet name"
}
},
"vnetAddressPrefix": {
"type": "string",
"defaultValue": "192.168.0.0/16",
"metadata": {
"description": "VNET Address prefix"
}
},
"subnet1Prefix": {
"type": "string",
"defaultValue": "192.168.254.0/24",
"metadata": {
"description": "Local Subnet prefix"
}
},
"subnet2Prefix": {
"type": "string",
"defaultValue": "192.168.253.0/24",
"metadata": {
"description": "Local Subnet Prefix"
}
}
},
"variables": {
"subnet1Name": "Spoke",
"subnet2Name": "Local",
"Location": "[resourceGroup().location]",
"ResourceGroupName": "[resourceGroup().name]",
"LocalSubscriptionid": "[subscription().subscriptionId]",
"HubRemoteSubscriptionID" : "85e3593c-6a07-4e81-a447-a06d6f5e6f89",
"hubResourceGroupName": "CoreNetwork",
"HubRemoteNetwork": "CoreNetwork",
"LocalVNETID": "[resourceId(variables('LocalSubscriptionid'), variables('ResourceGroupName'), 'Microsoft.Network/virtualNetworks', parameters('vnetName'))]",
"RemoteVNETID": "[resourceId(variables('HubRemoteSubscriptionID'), variables('HubRemoteNetwork'), 'Microsoft.Network/virtualNetworks', variables('HubRemoteNetwork'))]",
"vNet1tovNet2PeeringName": "[concat('Peering',variables('HubRemoteNetwork'))]",
"vNet2tovNet1PeeringName": "[concat('Peering',parameters('vnetName'))]",
"RouteTableName": "ToCentralFirewallEurope",
"RouteTablePrefix": "0.0.0.0/0",
"CentralFirewallIP": "10.0.254.4"
},
"resources": [
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('vnetName')]",
"location": "[variables('Location')]",
"dependsOn": [
"[concat('Microsoft.Network/routeTables/', variables('RouteTableName'))]"
],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[parameters('vnetAddressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnet1Name')]",
"properties": {
"addressPrefix": "[parameters('subnet1Prefix')]",
"routeTable": {
"id": "[resourceId('Microsoft.Network/routeTables', variables('RouteTableName'))]"
}
}
},
{
"name": "[variables('subnet2Name')]",
"properties": {
"addressPrefix": "[parameters('subnet2Prefix')]",
"routeTable": {
"id": "[resourceId('Microsoft.Network/routeTables', variables('RouteTableName'))]"
}
}
}
]
},
"resources": [
{
"apiVersion": "2016-06-01",
"type": "virtualNetworkPeerings",
"name": "[variables('vNet1tovNet2PeeringName')]",
"location": "[variables('Location')]",
"dependsOn": [
"[variables('LocalVNETID')]"
],
"properties": {
"allowVirtualNetworkAccess": "true",
"allowForwardedTraffic": "false",
"allowGatewayTransit": "false",
"useRemoteGateways": "false",
"remoteVirtualNetwork": {
"id": "[variables('RemoteVNETID')]"
}
}
}
]
},
{
"type": "Microsoft.Network/routeTables",
"name": "[variables('RouteTableName')]",
"apiVersion": "2015-06-15",
"location": "[variables('Location')]",
"properties": {
"routes": [
{
"name": "[variables('RouteTableName')]",
"properties": {
"addressPrefix": "[variables('RouteTablePrefix')]",
"nextHopType": "VirtualAppliance",
"nextHopIpAddress": "[variables('CentralFirewallIP')]"
}
}
]
}
},
{
"apiVersion": "2017-05-10",
"name": "nestedTemplate",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "[variables('hubResourceGroupName')]",
"subscriptionId": "[variables('HubRemoteSubscriptionID')]",
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"resources": [
{
"apiVersion": "2016-06-01",
"type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
"name": "[concat(variables('HubRemoteNetwork'),'/', variables('vNet2tovNet1PeeringName'))]",
"location": "[resourceGroup().location]",
"properties": {
"allowVirtualNetworkAccess": "true",
"allowForwardedTraffic": "false",
"allowGatewayTransit": "false",
"useRemoteGateways": "false",
"remoteVirtualNetwork": {
"id": "[resourceId(variables('LocalSubscriptionid'), variables('ResourceGroupName'), 'Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
}
}
}
]
}
}
}
]
}
You can’t perform that action at this time.