Skip to content

Instantly share code, notes, and snippets.

@SidneyAndrewsOpsgility
Created September 22, 2015 18:15
Show Gist options
  • Save SidneyAndrewsOpsgility/2189eda4719445e0682e to your computer and use it in GitHub Desktop.
Save SidneyAndrewsOpsgility/2189eda4719445e0682e to your computer and use it in GitHub Desktop.
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"VirtualNetworkPrefix": {
"type": "string",
"metadata": {
"description": "Name for the virtual network"
}
}
},
"variables": {
"ComputeSubnetName": "Apps",
"GatewaySubnetName": "GatewaySubnet",
"VirtualNetworkAddressPrefix": "10.1.0.0/16",
"ComputeSubnetAddressPrefix": "10.1.1.0/28",
"GatewaySubnetAddressPrefix": "10.1.0.0/28",
"EastVirtualNetworkName": "[concat(parameters('VirtualNetworkPrefix'), 'East')]",
"EastVirtualNetworkLocation": "East US",
"EastPublicIPName": "[concat(variables('EastVirtualNetworkName'), 'PublicIP')]",
"EastGatewayName": "[concat(variables('EastVirtualNetworkName'), 'VirtualNetworkGateway')]",
"EastLocalGatewayName": "[concat(variables('EastVirtualNetworkName'), 'VirtualNetworkLocalGateway')]",
"EastVNetResourceID": "[resourceId('Microsoft.Network/virtualNetworks', variables('EastVirtualNetworkName'))]",
"EastGatewayResourceID": "[concat(variables('EastVNetResourceID'), '/subnets/', variables('GatewaySubnetName'))]",
"EastPublicIPResourceID": "[resourceId('Microsoft.Network/publicIPAddresses', variables('EastPublicIPName'))]",
"WestVirtualNetworkName": "[concat(parameters('VirtualNetworkPrefix'), 'West')]",
"WestVirtualNetworkLocation": "West US",
"WestPublicIPName": "[concat(variables('WestVirtualNetworkName'), 'PublicIP')]",
"WestGatewayName": "[concat(variables('WestVirtualNetworkName'), 'VirtualNetworkGateway')]",
"WestLocalGatewayName": "[concat(variables('WestVirtualNetworkName'), 'VirtualNetworkLocalGateway')]",
"WestVNetResourceID": "[resourceId('Microsoft.Network/virtualNetworks', variables('WestVirtualNetworkName'))]",
"WestGatewayResourceID": "[concat(variables('WestVNetResourceID'), '/subnets/', variables('GatewaySubnetName'))]",
"WestPublicIPResourceID": "[resourceId('Microsoft.Network/publicIPAddresses', variables('WestPublicIPName'))]"
},
"resources": [
{
"name": "[variables('EastVirtualNetworkName')]",
"type": "Microsoft.Network/virtualNetworks",
"location": "[variables('EastVirtualNetworkLocation')]",
"apiVersion": "2015-05-01-preview",
"dependsOn": [ ],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('VirtualNetworkAddressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('ComputeSubnetName')]",
"properties": {
"addressPrefix": "[variables('ComputeSubnetAddressPrefix')]"
}
},
{
"name": "[variables('GatewaySubnetName')]",
"properties": {
"addressPrefix": "[variables('GatewaySubnetAddressPrefix')]"
}
}
]
}
},
{
"name": "[variables('EastPublicIPName')]",
"type": "Microsoft.Network/publicIPAddresses",
"location": "[variables('EastVirtualNetworkLocation')]",
"apiVersion": "2015-05-01-preview",
"properties": {
"publicIPAllocationMethod": "Dynamic"
}
},
{
"name": "[variables('EastGatewayName')]",
"type": "Microsoft.Network/virtualNetworkGateways",
"location": "[variables('EastVirtualNetworkLocation')]",
"apiVersion": "2015-05-01-preview",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('EastPublicIPName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('EastVirtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [
{
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('EastGatewayResourceID')]"
},
"publicIPAddress": {
"id": "[variables('EastPublicIPResourceID')]"
}
},
"name": "GatewayConfig"
}
],
"gatewayType": "Vpn",
"vpnType": "RouteBased",
"enableBgp": false
}
},
{
"name": "[variables('EastLocalGatewayName')]",
"type": "Microsoft.Network/localNetworkGateways",
"location": "[variables('EastVirtualNetworkLocation')]",
"apiVersion": "2015-05-01-preview",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('EastPublicIPName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('EastVirtualNetworkName'))]",
"[concat('Microsoft.Network/virtualNetworkGateways/', variables('EastGatewayName'))]"
],
"properties": {
"localNetworkAddressSpace": {
"addressPrefixes": [
"[variables('GatewaySubnetAddressPrefix')]"
]
},
"gatewayIpAddress": "[reference(variables('WestPublicIPName')).ipAddress]"
}
},
{
"name": "[variables('WestVirtualNetworkName')]",
"type": "Microsoft.Network/virtualNetworks",
"location": "[variables('WestVirtualNetworkLocation')]",
"apiVersion": "2015-05-01-preview",
"dependsOn": [ ],
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('VirtualNetworkAddressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('ComputeSubnetName')]",
"properties": {
"addressPrefix": "[variables('ComputeSubnetAddressPrefix')]"
}
},
{
"name": "[variables('GatewaySubnetName')]",
"properties": {
"addressPrefix": "[variables('GatewaySubnetAddressPrefix')]"
}
}
]
}
},
{
"name": "[variables('WestPublicIPName')]",
"type": "Microsoft.Network/publicIPAddresses",
"location": "[variables('WestVirtualNetworkLocation')]",
"apiVersion": "2015-05-01-preview",
"properties": {
"publicIPAllocationMethod": "Dynamic"
}
},
{
"name": "[variables('WestGatewayName')]",
"type": "Microsoft.Network/virtualNetworkGateways",
"location": "[variables('WestVirtualNetworkLocation')]",
"apiVersion": "2015-05-01-preview",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('WestPublicIPName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('WestVirtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [
{
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('WestGatewayResourceID')]"
},
"publicIPAddress": {
"id": "[variables('WestPublicIPResourceID')]"
}
},
"name": "GatewayConfig"
}
],
"gatewayType": "Vpn",
"vpnType": "RouteBased",
"enableBgp": false
}
},
{
"name": "[variables('WestLocalGatewayName')]",
"type": "Microsoft.Network/localNetworkGateways",
"location": "[variables('WestVirtualNetworkLocation')]",
"apiVersion": "2015-05-01-preview",
"dependsOn": [
"[concat('Microsoft.Network/publicIPAddresses/', variables('WestPublicIPName'))]",
"[concat('Microsoft.Network/virtualNetworks/', variables('WestVirtualNetworkName'))]",
"[concat('Microsoft.Network/virtualNetworkGateways/', variables('WestGatewayName'))]"
],
"properties": {
"localNetworkAddressSpace": {
"addressPrefixes": [
"[variables('GatewaySubnetAddressPrefix')]"
]
},
"gatewayIpAddress": "[reference(variables('EastPublicIPName')).ipAddress]"
}
}
],
"outputs": {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment