Skip to content

Commit 786cacf

Browse files
committed
fix(build): enable SQL auditing and threat detection for Checkov compliance
- add auditing settings with 91-day retention on SQL server and database (CKV_AZURE_23, CKV_AZURE_24) - add threat detection policies on SQL server and database (CKV_AZURE_25) Relates to #51 🔒 - Generated by Copilot
1 parent 0e53b88 commit 786cacf

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

blueprints/sample-web-app/bicep/main.bicep

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ resource sqlServer 'Microsoft.Sql/servers@2023-08-01-preview' = {
145145
}
146146
}
147147

148+
@description('SQL Server auditing policy — CKV_AZURE_23, CKV_AZURE_24.')
149+
resource sqlServerAudit 'Microsoft.Sql/servers/auditingSettings@2023-08-01-preview' = {
150+
parent: sqlServer
151+
name: 'default'
152+
properties: {
153+
state: 'Enabled'
154+
isAzureMonitorTargetEnabled: true
155+
retentionDays: 91
156+
}
157+
}
158+
159+
@description('SQL Server threat detection — CKV_AZURE_25.')
160+
resource sqlServerThreatDetection 'Microsoft.Sql/servers/securityAlertPolicies@2023-08-01-preview' = {
161+
parent: sqlServer
162+
name: 'default'
163+
properties: {
164+
state: 'Enabled'
165+
}
166+
}
167+
148168
/* ========================================================================== */
149169
/* SQL Database */
150170
/* ========================================================================== */
@@ -163,6 +183,26 @@ resource sqlDatabase 'Microsoft.Sql/servers/databases@2023-08-01-preview' = {
163183
}
164184
}
165185

186+
@description('SQL Database auditing policy — CKV_AZURE_23, CKV_AZURE_24.')
187+
resource sqlDatabaseAudit 'Microsoft.Sql/servers/databases/auditingSettings@2023-08-01-preview' = {
188+
parent: sqlDatabase
189+
name: 'default'
190+
properties: {
191+
state: 'Enabled'
192+
isAzureMonitorTargetEnabled: true
193+
retentionDays: 91
194+
}
195+
}
196+
197+
@description('SQL Database threat detection — CKV_AZURE_25.')
198+
resource sqlDatabaseThreatDetection 'Microsoft.Sql/servers/databases/securityAlertPolicies@2023-08-01-preview' = {
199+
parent: sqlDatabase
200+
name: 'default'
201+
properties: {
202+
state: 'Enabled'
203+
}
204+
}
205+
166206
/* ========================================================================== */
167207
/* Key Vault Access for App Service */
168208
/* ========================================================================== */

0 commit comments

Comments
 (0)