-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappservices-tidal.bicep
209 lines (189 loc) · 4.91 KB
/
appservices-tidal.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
// This template is used as a module from the main.bicep template.
// The module contains a template to create network resources.
targetScope = 'resourceGroup'
param location string
param prefix string
param tags object
@description('Admin username')
param adminUsername string
@description('Admin password')
@secure()
param adminPassword string
@description('Prefix to use for VM names')
param vmNamePrefix string = '${prefix}vm'
@description('Size of the virtual machines')
param vmSize string = 'Standard_D2as_v5'
@description('Loab Balancer name')
param loadBalancerName string = '${prefix}-ilb'
@description('Network Interface name')
param networkInterfaceName string = '${prefix}-nic'
@description('Availability Set name')
param availabilitySetName string = '${prefix}-AvSet'
@description('Storage Type for Vhds')
param storageAccountType string = 'Standard_LRS'
var storageAccountName = uniqueString(resourceGroup().id)
var numberOfInstances = 2
@description('VNet Name')
param vnetName string
@description('Subnet Name')
param subnetName string
resource appServiceSubnet 'Microsoft.Network/virtualNetworks/subnets@2021-02-01' existing = {
name: '${vnetName}/${subnetName}'
}
resource storageAccount 'Microsoft.Storage/storageAccounts@2021-08-01' = {
name: storageAccountName
location: location
tags: tags
sku: {
name: storageAccountType
}
kind: 'StorageV2'
}
resource availabilitySet 'Microsoft.Compute/availabilitySets@2021-11-01' = {
name: availabilitySetName
location: location
tags: tags
sku: {
name: 'Aligned'
}
properties: {
platformUpdateDomainCount: 2
platformFaultDomainCount: 2
}
}
resource networkInterface 'Microsoft.Network/networkInterfaces@2021-05-01' = [for i in range(0, numberOfInstances): {
name: '${networkInterfaceName}${i}'
location: location
tags: tags
properties: {
ipConfigurations: [
{
name: 'ipconfig1'
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: appServiceSubnet.id
}
loadBalancerBackendAddressPools: [
{
id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', loadBalancerName, 'BackendPool1')
}
]
}
}
]
}
dependsOn: [
loadBalancer
]
}]
resource loadBalancer 'Microsoft.Network/loadBalancers@2021-05-01' = {
name: loadBalancerName
location: location
tags: tags
sku: {
name: 'Standard'
}
properties: {
frontendIPConfigurations: [
{
properties: {
subnet: {
id: appServiceSubnet.id
}
privateIPAllocationMethod: 'Dynamic'
}
name: 'LoadBalancerFrontend'
}
]
backendAddressPools: [
{
name: 'BackendPool1'
}
]
loadBalancingRules: [
{
properties: {
frontendIPConfiguration: {
id: resourceId('Microsoft.Network/loadBalancers/frontendIpConfigurations', loadBalancerName, 'LoadBalancerFrontend')
}
backendAddressPool: {
id: resourceId('Microsoft.Network/loadBalancers/backendAddressPools', loadBalancerName, 'BackendPool1')
}
probe: {
id: resourceId('Microsoft.Network/loadBalancers/probes', loadBalancerName, 'lbprobe')
}
protocol: 'Tcp'
frontendPort: 80
backendPort: 80
idleTimeoutInMinutes: 15
}
name: 'lbrule'
}
]
probes: [
{
properties: {
protocol: 'Tcp'
port: 80
intervalInSeconds: 15
numberOfProbes: 2
}
name: 'lbprobe'
}
]
}
}
resource vm 'Microsoft.Compute/virtualMachines@2021-11-01' = [for i in range(0, numberOfInstances): {
name: '${vmNamePrefix}${i}'
location: location
tags: tags
plan: {
name: 'tidal_tools'
publisher: 'tidal-migrations'
product: 'tidal_tools'
}
properties: {
availabilitySet: {
id: availabilitySet.id
}
hardwareProfile: {
vmSize: vmSize
}
osProfile: {
computerName: '${vmNamePrefix}${i}'
adminUsername: adminUsername
adminPassword: adminPassword
}
storageProfile: {
osDisk: {
createOption: 'FromImage'
managedDisk: {
storageAccountType: storageAccountType
}
}
// This is a placeholder image reference. You should replace this with your desired image reference.
imageReference: {
publisher: 'tidal-migrations'
offer: 'tidal_tools'
sku: 'tidal_tools'
version: 'latest'
}
}
networkProfile: {
networkInterfaces: [
{
id: networkInterface[i].id
}
]
}
diagnosticsProfile: {
bootDiagnostics: {
enabled: true
storageUri: storageAccount.properties.primaryEndpoints.blob
}
}
}
}]