-
Notifications
You must be signed in to change notification settings - Fork 0
/
virtualnetwork.bicep
101 lines (92 loc) · 2.64 KB
/
virtualnetwork.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//This bicep deploys the Virtual Network.
//Scope
targetScope = 'resourceGroup'
//Parameters
param env string
param larid string
param location string
param vnetspace string
param mainsnetspace string
param funcsnetspace string
param funcnsg string
param mainnsg string
//Resources
//This deploys the Virtual Network Resource Type and Subnet Resource Type.
resource virtualnetwork 'Microsoft.Network/virtualNetworks@2023-09-01' = {
name: 'vnet-ADXFlowmaster-${env}'
location: location
properties: {
addressSpace: {
addressPrefixes: [
vnetspace
]
}
subnets: [
{
name: 'main'
properties: {
addressPrefix: mainsnetspace
privateEndpointNetworkPolicies: 'Disabled'
privateLinkServiceNetworkPolicies: 'Disabled'
defaultOutboundAccess: false
networkSecurityGroup: {
id: mainnsg
}
serviceEndpoints: [
{
service: 'Microsoft.AzureActiveDirectory'
}
]
}
}
{
name: 'func'
properties: {
addressPrefix: funcsnetspace
privateEndpointNetworkPolicies: 'Disabled'
privateLinkServiceNetworkPolicies: 'Disabled'
defaultOutboundAccess: false
networkSecurityGroup: {
id: funcnsg
}
serviceEndpoints: [
{
service: 'Microsoft.AzureActiveDirectory'
}
]
delegations: [
{
name: 'Microsoft.Web/serverFarms'
properties: {
serviceName: 'Microsoft.Web/serverFarms'
}
}
]
}
}
]
}
}
//Diagnostic settings for Virtual Network
resource virtualnetworkdiag 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = {
name: 'Monitor'
scope: virtualnetwork
properties: {
metrics: [
{
category: 'allMetrics'
enabled: true
}
]
workspaceId: larid
}
}
//Outputs
output virtualnetworkid string = virtualnetwork.id
output virtualnetworkname string = virtualnetwork.name
output mainsubnetresourceid string = resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet-ADXFlowmaster-${env}', 'main')
output funcsubnetresourceid string = resourceId('Microsoft.Network/virtualNetworks/subnets', 'vnet-ADXFlowmaster-${env}', 'func')
output mainsubnetid string = virtualnetwork.properties.subnets[0].id
output funcsubnetid string = virtualnetwork.properties.subnets[1].id
output mainsubnetname string = virtualnetwork.properties.subnets[0].name
output funcsubnetname string = virtualnetwork.properties.subnets[1].name