-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazuredeploy.bicep
126 lines (113 loc) · 3.32 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
@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
@allowed([
'Basic' // 5 DTUs, ~ 5 CHF
'S0' // 10 DTUs, ~ 20 CHF
'S1' // 20 DTUs, ~ 45 CHF
'S2' // 50 DTUs, ~ 115 CHF
'S3' // 100 DTUs, ~ 225 CHF
])
param sqlServerSku string = 'S0'
param sqlServerAdminUsername string = 'customer-admin'
@secure()
param sqlServerAdminPassword string
var logAnalyticsWsName = '${resourceNamePrefix}-law-${resourceNameSuffix}'
var sqlServerName = '${resourceNamePrefix}-sql-${resourceNameSuffix}'
var sqlDatabaseName = '${resourceNamePrefix}-sqldb-${resourceNameSuffix}'
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 logAnalyticsWsRes 'Microsoft.OperationalInsights/workspaces@2020-08-01' = {
name: logAnalyticsWsName
location: resourceLocation
properties: {
sku: {
name: 'PerGB2018'
}
retentionInDays: 30
}
}
resource sqlServerRes 'Microsoft.Sql/servers@2021-11-01' = {
name: sqlServerName
location: resourceLocation
identity: {
type: 'SystemAssigned'
}
properties: {
administratorLogin: sqlServerAdminUsername
administratorLoginPassword: sqlServerAdminPassword
minimalTlsVersion: '1.2'
version: '12.0'
publicNetworkAccess: 'Enabled'
restrictOutboundNetworkAccess: 'Disabled'
}
}
resource sqlServerFirewallRuleRes 'Microsoft.Sql/servers/firewallRules@2021-11-01' = {
parent: sqlServerRes
name: 'AllowAllWindowsAzureIps'
properties: {
startIpAddress: '0.0.0.0'
endIpAddress: '0.0.0.0'
}
}
resource sqlDatabaseRes 'Microsoft.Sql/servers/databases@2021-11-01' = {
parent: sqlServerRes
name: sqlDatabaseName
location: resourceLocation
sku: {
name: sqlServerSku
}
properties: {
collation: 'SQL_Latin1_General_CP1_CI_AS'
highAvailabilityReplicaCount: 0
isLedgerOn: false
maxSizeBytes: 268435456000
readScale: 'Disabled'
requestedBackupStorageRedundancy: 'Geo'
zoneRedundant: false
}
}
resource sqlDatabaseDiagnosticsRes 'Microsoft.Insights/diagnosticSettings@2017-05-01-preview' = {
name: 'LogAnalytics'
scope: sqlDatabaseRes
properties: {
workspaceId: logAnalyticsWsRes.id
logs: [
{
category: 'Errors'
enabled: true
}
{
category: 'Timeouts'
enabled: true
}
{
category: 'Blocks'
enabled: true
}
{
category: 'Deadlocks'
enabled: true
}
]
metrics: [
{
category: 'Basic'
enabled: true
}
]
}
}
#disable-next-line outputs-should-not-contain-secrets
output sqlDatabaseConnectionString string = 'Server=tcp:${reference(sqlServerName).fullyQualifiedDomainName},1433;Initial Catalog=${sqlDatabaseName};Persist Security Info=False;User ID=${sqlServerAdminUsername};Password=${sqlServerAdminPassword};Connection Timeout=30;'