Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vnet-to-vnet-peering example #1274

Merged
merged 2 commits into from Jan 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
69 changes: 69 additions & 0 deletions docs/examples/201/vnet-to-vnet-peering/main.bicep
@@ -0,0 +1,69 @@
param location string = resourceGroup().location
param vNet1Name string = 'VNet1'
param vNet2Name string = 'VNet2'

resource vNet1 'Microsoft.Network/virtualNetworks@2020-06-01' = {
name: vNet1Name
location: location
properties: {
addressSpace: {
addressPrefixes: [
'10.0.0.0/24'
]
}
subnets: [
{
name: 'subnet1'
properties: {
addressPrefix: '10.0.0.0/24'
}
}
]
}
}

resource VnetPeering1 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-06-01' = {
name: '${vNet1.name}/${vNet1.name}-${vNet2.name}'
properties: {
allowVirtualNetworkAccess: true
allowForwardedTraffic: false
allowGatewayTransit: false
useRemoteGateways: false
remoteVirtualNetwork: {
id: vNet2.id
}
}
}

resource vNet2 'Microsoft.Network/virtualNetworks@2020-06-01' = {
name: vNet2Name
location: location
properties: {
addressSpace: {
addressPrefixes: [
'192.168.0.0/24'
]
}
subnets: [
{
name: 'subnet1'
properties: {
addressPrefix: '192.168.0.0/24'
}
}
]
}
}

resource VnetPeering2 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@2020-06-01' = {
name: '${vNet2.name}/${vNet2.name}-${vNet1.name}'
properties: {
allowVirtualNetworkAccess: true
allowForwardedTraffic: false
allowGatewayTransit: false
useRemoteGateways: false
remoteVirtualNetwork: {
id: vNet1.id
}
}
}
99 changes: 99 additions & 0 deletions docs/examples/201/vnet-to-vnet-peering/main.json
@@ -0,0 +1,99 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
},
"vNet1Name": {
"type": "string",
"defaultValue": "VNet1"
},
"vNet2Name": {
"type": "string",
"defaultValue": "VNet2"
}
},
"functions": [],
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2020-06-01",
"name": "[parameters('vNet1Name')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/24"
]
},
"subnets": [
{
"name": "subnet1",
"properties": {
"addressPrefix": "10.0.0.0/24"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
"apiVersion": "2020-06-01",
"name": "[format('{0}/{1}-{2}', parameters('vNet1Name'), parameters('vNet1Name'), parameters('vNet2Name'))]",
"properties": {
"allowVirtualNetworkAccess": true,
"allowForwardedTraffic": false,
"allowGatewayTransit": false,
"useRemoteGateways": false,
"remoteVirtualNetwork": {
"id": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vNet2Name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('vNet1Name'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('vNet2Name'))]"
]
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2020-06-01",
"name": "[parameters('vNet2Name')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"192.168.0.0/24"
]
},
"subnets": [
{
"name": "subnet1",
"properties": {
"addressPrefix": "192.168.0.0/24"
}
}
]
}
},
{
"type": "Microsoft.Network/virtualNetworks/virtualNetworkPeerings",
"apiVersion": "2020-06-01",
"name": "[format('{0}/{1}-{2}', parameters('vNet2Name'), parameters('vNet2Name'), parameters('vNet1Name'))]",
"properties": {
"allowVirtualNetworkAccess": true,
"allowForwardedTraffic": false,
"allowGatewayTransit": false,
"useRemoteGateways": false,
"remoteVirtualNetwork": {
"id": "[resourceId('Microsoft.Network/virtualNetworks', parameters('vNet1Name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('vNet1Name'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('vNet2Name'))]"
]
}
]
}
10 changes: 7 additions & 3 deletions docs/examples/index.json
Expand Up @@ -40,8 +40,8 @@
"description": "101/azure-bastion"
},
{
"filePath":"101/basic-batch-account/main.bicep",
"description":"101/basic-batch-account"
"filePath": "101/basic-batch-account/main.bicep",
"description": "101/basic-batch-account"
},
{
"filePath": "101/azure-search-create/main.bicep",
Expand Down Expand Up @@ -347,6 +347,10 @@
"filePath": "201/vnet-to-vnet-bgp/main.bicep",
"description": "201/vnet-to-vnet-bgp"
},
{
"filePath": "201/vnet-to-vnet-peering/main.bicep",
"description": "201/vnet-to-vnet-peering"
},
{
"filePath": "201/vwan-shared-services/main.bicep",
"description": "201/vwan-shared-services"
Expand Down Expand Up @@ -378,7 +382,7 @@
{
"filePath": "201/shared-image-gallery-with-image-defintition-and-role-assignment/main.bicep",
"description": "201/shared-image-gallery-with-image-defintition-and-role-assignment"
},
},
{
"filePath": "301/function-app-with-custom-domain-managed-certificate/main.bicep",
"description": "301/function-app-with-custom-domain-managed-certificate"
Expand Down