-
Notifications
You must be signed in to change notification settings - Fork 2
/
azuredeploy.bicep
141 lines (129 loc) · 3.67 KB
/
azuredeploy.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
@description('The prefix will be used for every parameter that represents a resource name')
param resourceNamePrefix string = 'customer-project'
@description('The suffix will be appended to every parameter that represents a resource name')
param resourceNameSuffix string
param resourceLocation string = resourceGroup().location
var logAnalyticsWsName = '${resourceNamePrefix}-law-${resourceNameSuffix}'
var appInsightsName = '${resourceNamePrefix}-ai-${resourceNameSuffix}'
var keyVaultName = '${resourceNamePrefix}-kv-${resourceNameSuffix}'
var keyVaultSecretStorageAccountConnectionString = 'storageAccountConnectionString'
var blobContainerConfig = 'config'
var blobContainerDeployment = 'deployment'
var storageAccountName = replace('${resourceNamePrefix}-sa-${resourceNameSuffix}', '-', '')
var storageAccountBlobs = [
{
name: blobContainerConfig
publicAccess: 'None'
}
{
name: blobContainerDeployment
publicAccess: 'None'
}
]
resource partnerIdRes 'Microsoft.Resources/deployments@2020-06-01' = {
name: 'pid-d16e7b59-716a-407d-96db-18d1cac40407'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
resources: []
}
}
}
resource storageAccountRes 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageAccountName
location: resourceLocation
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
networkAcls: {
bypass: 'AzureServices'
defaultAction: 'Allow'
}
supportsHttpsTrafficOnly: true
encryption: {
services: {
file: {
enabled: true
}
blob: {
enabled: true
}
}
keySource: 'Microsoft.Storage'
}
accessTier: 'Hot'
}
}
resource storageAccountBlobContainerRes 'Microsoft.Storage/storageAccounts/blobServices/containers@2019-06-01' = [for item in storageAccountBlobs: {
name: '${storageAccountName}/default/${item.name}'
properties: {
publicAccess: item.publicAccess
}
dependsOn: [
storageAccountRes
]
}]
resource logAnalyticsWsRes 'Microsoft.OperationalInsights/workspaces@2020-08-01' = {
name: logAnalyticsWsName
location: resourceLocation
properties: {
sku: {
name: 'PerGB2018'
}
retentionInDays: 30
}
}
resource appInsightsRes 'Microsoft.Insights/components@2020-02-02' = {
name: appInsightsName
location: resourceLocation
kind: 'web'
properties: {
Application_Type: 'web'
WorkspaceResourceId: logAnalyticsWsRes.id
}
}
resource keyVaultRes 'Microsoft.KeyVault/vaults@2022-07-01' = {
name: keyVaultName
location: resourceLocation
properties: {
sku: {
family: 'A'
name: 'standard'
}
tenantId: subscription().tenantId
enabledForTemplateDeployment: true
enableRbacAuthorization: false
enableSoftDelete: true // With default of softDeleteRetentionInDays = 90
accessPolicies: []
}
}
resource keyVaultDiagnosticsRes 'Microsoft.Insights/diagnosticSettings@2017-05-01-preview' = {
name: 'LogAnalytics'
scope: keyVaultRes
properties: {
workspaceId: logAnalyticsWsRes.id
logs: [
{
category: 'AuditEvent'
enabled: true
}
]
metrics: [
{
category: 'AllMetrics'
enabled: true
}
]
}
}
resource keyVaultSecretStorageAccountConnectionStringRes 'Microsoft.KeyVault/vaults/secrets@2022-07-01' = {
parent: keyVaultRes
name: keyVaultSecretStorageAccountConnectionString
properties: {
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccountName};AccountKey=${listKeys(storageAccountRes.id, '2019-06-01').keys[0].value}'
}
}