-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.bicep
77 lines (76 loc) · 1.91 KB
/
main.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
param virtualNetworkName string = 'vnet-01'
param virtualNetworkPrefix string
param subnetName string
param subnetPrefix string
param gatewaySubnetPrefix string
param gatewayPublicIPName string
param gatewayName string
param connectionName string
param circuitName string
param location string = resourceGroup().location
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2020-06-01' = {
name: virtualNetworkName
location: location
properties: {
addressSpace: {
addressPrefixes: [
virtualNetworkPrefix
]
}
}
}
resource subnet 'Microsoft.Network/virtualNetworks/subnets@2020-06-01' = {
name: '${virtualNetwork.name}/${subnetName}'
properties: {
addressPrefix: subnetPrefix
}
}
resource gatewaySubnet 'Microsoft.Network/virtualNetworks/subnets@2020-06-01' = {
name: '${virtualNetwork.name}/GatewaySubnet'
properties: {
addressPrefix: gatewaySubnetPrefix
}
}
resource publicIP 'Microsoft.Network/publicIPAddresses@2020-06-01' = {
name: gatewayPublicIPName
location: location
properties: {
publicIPAllocationMethod: 'Dynamic'
}
}
resource virtualNetworkGateway 'Microsoft.Network/virtualNetworkGateways@2020-06-01' = {
name: gatewayName
location: location
properties: {
ipConfigurations: [
{
name: 'vnetGatewayConfig'
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: gatewaySubnet.id
}
publicIPAddress: {
id: publicIP.id
}
}
}
]
gatewayType: 'ExpressRoute'
}
}
resource connection 'Microsoft.Network/connections@2020-06-01' = {
name: connectionName
location: location
properties: {
virtualNetworkGateway1: {
id: virtualNetworkGateway.id
properties: {}
}
peer: {
id: resourceId('Microsoft.Network/expressRouteCircuits', circuitName)
}
connectionType: 'ExpressRoute'
routingWeight: 3
}
}