-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.bicep
86 lines (76 loc) · 2.73 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
type dataCollectionConfig = {
ruleName: string
endpointName: string
workspaceName: string
}
type functionAppConfig = {
name: string
keyvaultName: string
keyvaultSecretName: string
container: string
}
param beyondTrustTenant string
param datacollection dataCollectionConfig
param functionConfig functionAppConfig
resource userAssignedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-07-31-preview' = {
name: '${functionConfig.name}-${uniqueString(resourceGroup().name)}'
location: resourceGroup().location
}
module datacollectionModule './modules/datacollection.bicep' = {
name: 'datacollection'
params: {
principalId: userAssignedIdentity.properties.principalId
ruleName: datacollection.ruleName
endpointName: datacollection.endpointName
workspaceName: datacollection.workspaceName
}
}
module functionappModule './modules/functionapp.bicep' = {
name: 'functionapp'
params: {
appName: '${functionConfig.name}-${uniqueString(resourceGroup().name)}'
location: resourceGroup().location
keyvaultName: functionConfig.keyvaultName
keyvaultSecretName: functionConfig.keyvaultSecretName
userAssignedIdentityId: userAssignedIdentity.id
clientId: userAssignedIdentity.properties.clientId
container: functionConfig.container
dataCollection: {
workspaceName: datacollectionModule.outputs.workspaceId
endpointImmutableId: datacollectionModule.outputs.dcrImmutableId
endpointUri: datacollectionModule.outputs.logsIngestionEndpoint
beyondTrustTenant: beyondTrustTenant
}
}
}
module vaultSecretUserRoleAssignment './modules/vault-role-assignment.bicep' = {
name: 'vaultSecretUserRoleAssignment'
params: {
roleAssignmentName: '${uniqueString(functionConfig.name)}-keyvault-reader-role-assignment'
roleDefinitionId: '4633458b-17de-408a-b874-0445c86b69e6' // Key Vault Secret User
principalId: userAssignedIdentity.properties.principalId
keyVaultName: functionConfig.keyvaultName
secretName: functionConfig.keyvaultSecretName
}
}
module workspaceReaderRoleAssignment './modules/workspace-role-assignment.bicep' = {
name: 'workspaceReaderRoleAssignment'
params: {
roleAssignmentName: '${uniqueString(functionConfig.name)}-workspace-reader-role-assignment'
roleDefinitionId: '73c42c96-874c-492b-b04d-ab87d138a893' // Log Analytics Reader
principalId: userAssignedIdentity.properties.principalId
workspaceName: datacollection.workspaceName
}
}
module asimParsers './modules/asimparsers.bicep' = {
name: 'asimParsers'
params: {
workspaceName: datacollection.workspaceName
}
}
module workbooks './modules/workbooks.bicep' = {
name: 'workbooks'
params: {
workspaceName: datacollection.workspaceName
}
}