-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.bicep
179 lines (136 loc) · 5.14 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
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
// targetScope = 'subscription'
targetScope = 'resourceGroup'
// Parameters
param deploymentParams object
param identityParams object
param storageAccountParams object
param logAnalyticsWorkspaceParams object
param vnetParams object
param vmParams object
param dceParams object
param mysqlFlexDbParams object
param brandTags object
param dateNow string = utcNow('yyyy-MM-dd-hh-mm')
param tags object = union(brandTags, {last_deployed:dateNow})
// Create Identity
module r_usr_mgd_identity 'modules/identity/create_usr_mgd_identity.bicep' = {
name: '${deploymentParams.enterprise_name_suffix}_${deploymentParams.global_uniqueness}_usr_mgd_identity'
params: {
deploymentParams:deploymentParams
identityParams:identityParams
tags: tags
}
}
// Create the Log Analytics Workspace
module r_logAnalyticsWorkspace 'modules/monitor/log_analytics_workspace.bicep' = {
name: '${logAnalyticsWorkspaceParams.workspaceName}_${deploymentParams.global_uniqueness}_La'
params: {
deploymentParams:deploymentParams
logAnalyticsWorkspaceParams: logAnalyticsWorkspaceParams
tags: tags
}
}
// Create Storage Account
module r_sa 'modules/storage/create_storage_account.bicep' = {
name: '${storageAccountParams.storageAccountNamePrefix}_${deploymentParams.global_uniqueness}_Sa'
params: {
deploymentParams:deploymentParams
storageAccountParams:storageAccountParams
tags: tags
}
}
// Create Storage Account - Blob container
module r_blob 'modules/storage/create_blob.bicep' = {
name: '${storageAccountParams.storageAccountNamePrefix}_${deploymentParams.global_uniqueness}_Blob'
params: {
deploymentParams:deploymentParams
storageAccountParams:storageAccountParams
storageAccountName: r_sa.outputs.saName
logAnalyticsWorkspaceId: r_logAnalyticsWorkspace.outputs.logAnalyticsPayGWorkspaceId
enableDiagnostics: false
}
dependsOn: [
r_sa
]
}
// Create the VNets
module r_vnet 'modules/vnet/create_vnet.bicep' = {
name: '${vnetParams.vnetNamePrefix}_${deploymentParams.global_uniqueness}_Vnet'
params: {
deploymentParams:deploymentParams
vnetParams:vnetParams
tags: tags
}
}
// Create Virtual Machine
module r_vm 'modules/vm/create_vm.bicep' = {
name: '${vmParams.vmNamePrefix}_${deploymentParams.global_uniqueness}_Vm'
params: {
deploymentParams:deploymentParams
r_usr_mgd_identity_name: r_usr_mgd_identity.outputs.usr_mgd_identity_name
saName: r_sa.outputs.saName
blobContainerName: r_blob.outputs.blobContainerName
saPrimaryEndpointsBlob: r_sa.outputs.saPrimaryEndpointsBlob
vmParams: vmParams
vnetName: r_vnet.outputs.vnetName
logAnalyticsPayGWorkspaceId:r_logAnalyticsWorkspace.outputs.logAnalyticsPayGWorkspaceId
linDataCollectionEndpointId: r_dataCollectionEndpoint.outputs.linDataCollectionEndpointId
storeEventsDcrId: r_dataCollectionRule.outputs.storeEventsDcrId
automationEventsDcrId: r_dataCollectionRule.outputs.automationEventsDcrId
tags: tags
}
dependsOn: [
r_vnet
]
}
// Create Data Collection Endpoint
module r_dataCollectionEndpoint 'modules/monitor/data_collection_endpoint.bicep' = {
name: '${dceParams.endpointNamePrefix}_${deploymentParams.global_uniqueness}_Dce'
params: {
deploymentParams:deploymentParams
dceParams: dceParams
osKind: 'linux'
tags: tags
}
}
// Create the Data Collection Rule
module r_dataCollectionRule 'modules/monitor/data_collection_rule.bicep' = {
name: '${logAnalyticsWorkspaceParams.workspaceName}_${deploymentParams.global_uniqueness}_Dcr'
params: {
deploymentParams:deploymentParams
osKind: 'Linux'
tags: tags
storeEventsRuleName: 'storeEvents_Dcr'
storeEventsLogFilePattern: '/var/log/miztiik*.json'
storeEventscustomTableNamePrefix: r_logAnalyticsWorkspace.outputs.storeEventsCustomTableNamePrefix
automationEventsRuleName: 'miztiikAutomation_Dcr'
automationEventsLogFilePattern: '/var/log/miztiik-automation-*.log'
automationEventsCustomTableNamePrefix: r_logAnalyticsWorkspace.outputs.automationEventsCustomTableNamePrefix
managedRunCmdRuleName: 'miztiikManagedRunCmd_Dcr'
managedRunCmdLogFilePattern: '/var/log/azure/run-command-handler/*.log'
managedRunCmdCustomTableNamePrefix: r_logAnalyticsWorkspace.outputs.managedRunCmdCustomTableNamePrefix
linDataCollectionEndpointId: r_dataCollectionEndpoint.outputs.linDataCollectionEndpointId
logAnalyticsPayGWorkspaceName:r_logAnalyticsWorkspace.outputs.logAnalyticsPayGWorkspaceName
logAnalyticsPayGWorkspaceId:r_logAnalyticsWorkspace.outputs.logAnalyticsPayGWorkspaceId
}
dependsOn: [
r_logAnalyticsWorkspace
]
}
// Create MySQL Database
module r_mysql 'modules/database/create_flex_mysql.bicep' = {
name: '${vmParams.vmNamePrefix}_${deploymentParams.global_uniqueness}_Mysql'
params: {
deploymentParams:deploymentParams
tags: tags
mysqlFlexDbParams: mysqlFlexDbParams
r_usr_mgd_identity_name: r_usr_mgd_identity.outputs.usr_mgd_identity_name
logAnalyticsPayGWorkspaceId:r_logAnalyticsWorkspace.outputs.logAnalyticsPayGWorkspaceId
create_replica: false
private_access: true
vnetName: r_vnet.outputs.vnetName
}
dependsOn: [
r_vm
]
}