SQL Server Alert Email Disabled
- Query id: 55975007-f6e7-4134-83c3-298f1fe4b519
- Query name: SQL Server Alert Email Disabled
- Platform: Terraform
- Severity: Info
- Category: Best Practices
- URL: Github
Description¶
SQL Server alert email should be enabled
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Positive test num. 1 - tf file
resource "azurerm_mssql_server_security_alert_policy" "positive1" {
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_sql_server.example.name
state = "Enabled"
storage_endpoint = azurerm_storage_account.example.primary_blob_endpoint
storage_account_access_key = azurerm_storage_account.example.primary_access_key
disabled_alerts = [
"Sql_Injection",
"Data_Exfiltration"
]
retention_days = 20
}
Positive test num. 2 - tf file
resource "azurerm_mssql_server_security_alert_policy" "positive2" {
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_sql_server.example.name
state = "Enabled"
storage_endpoint = azurerm_storage_account.example.primary_blob_endpoint
storage_account_access_key = azurerm_storage_account.example.primary_access_key
disabled_alerts = [
"Sql_Injection",
"Data_Exfiltration"
]
retention_days = 20
email_account_admins = false
}
Code samples without security vulnerabilities¶
Negative test num. 1 - tf file
resource "azurerm_mssql_server_security_alert_policy" "negative" {
resource_group_name = azurerm_resource_group.example.name
server_name = azurerm_sql_server.example.name
state = "Enabled"
storage_endpoint = azurerm_storage_account.example.primary_blob_endpoint
storage_account_access_key = azurerm_storage_account.example.primary_access_key
disabled_alerts = [
"Sql_Injection",
"Data_Exfiltration"
]
retention_days = 20
email_account_admins = true
}