Subscription has an Activity Log alert for SQL Server firewall rule create or update events
Azure Monitor activity log alerts are configured for Azure SQL Server firewall rule changes, targeting the Microsoft.Sql/servers/firewallRules/write operation.
This evaluates whether notifications or automated actions are set when firewall rules are created or updated.
Risk
Without alerting on firewall rule changes, unauthorized or accidental openings can remain unnoticed, exposing databases to untrusted networks.
This harms confidentiality (data exfiltration via widened IP ranges) and integrity (unauthorized queries), while increasing attacker dwell time.
Run this check with Prowler
Run in Prowler Cloudprowler azure --checks monitor_alert_create_update_sqlserver_frRecommendation
Enable an activity log alert for Microsoft.Sql/servers/firewallRules/write and route it to responsive action groups.
Apply least privilege for firewall management, enforce change approvals, and use defense in depth: prefer private endpoints and avoid broad public network access.
Remediation
CLI
az monitor activity-log alert create --name <activity_log_rule_name> --resource-group <resource_group_name> --scopes /subscriptions/<subscription_id> --condition "category=Administrative and operationName=Microsoft.Sql/servers/firewallRules/write" --location globalTerraform
# Activity Log alert for SQL Server firewall rule create/update
resource "azurerm_monitor_activity_log_alert" "<example_resource_name>" {
name = "<example_resource_name>"
resource_group_name = "<example_resource_name>"
scopes = ["/subscriptions/<example_resource_id>"]
criteria {
category = "Administrative"
operation_name = "Microsoft.Sql/servers/firewallRules/write" # Critical: alert on SQL Server firewall rule create/update
}
}NativeIaC
// Activity Log alert for SQL Server firewall rule create/update
resource example_activity_log_alert 'Microsoft.Insights/activityLogAlerts@2020-10-01' = {
name: '<example_resource_name>'
location: 'Global'
properties: {
enabled: true
scopes: [ '/subscriptions/<example_resource_id>' ]
condition: {
allOf: [
{
field: 'category'
equals: 'Administrative'
}
{
field: 'operationName'
equals: 'Microsoft.Sql/servers/firewallRules/write' // Critical: alert on SQL Server firewall rule create/update
}
]
}
}
}Other
Check Code
from prowler.lib.check.models import Check, Check_Report_Azure
from prowler.providers.azure.services.monitor.lib.monitor_alerts import check_alert_rule
from prowler.providers.azure.services.monitor.monitor_client import monitor_client
class monitor_alert_create_update_sqlserver_fr(Check):
def execute(self) -> Check_Report_Azure:
findings = []
for (
subscription_id,
activity_log_alerts,
) in monitor_client.alert_rules.items():
subscription_name = monitor_client.subscriptions.get(
subscription_id, subscription_id
)
for alert_rule in activity_log_alerts:
if check_alert_rule(
alert_rule, "Microsoft.Sql/servers/firewallRules/write"
):
report = Check_Report_Azure(
metadata=self.metadata(), resource=alert_rule
)
report.subscription = subscription_id
report.status = "PASS"
report.status_extended = f"There is an alert configured for creating/updating SQL Server firewall rule in subscription {subscription_name} ({subscription_id})."
break
else:
report = Check_Report_Azure(metadata=self.metadata(), resource={})
report.subscription = subscription_id
report.resource_name = subscription_id
report.resource_id = f"/subscriptions/{subscription_id}"
report.status = "FAIL"
report.status_extended = f"There is not an alert for creating/updating SQL Server firewall rule in subscription {subscription_name} ({subscription_id})."
findings.append(report)
return findingsReferences
- https://azure.microsoft.com/en-us/updates/classic-alerting-monitoring-retirement
- https://learn.microsoft.com/en-in/azure/azure-monitor/alerts/alerts-create-activity-log-alert-rule?tabs=activity-log
- https://www.trendmicro.com/cloudoneconformity/knowledge-base/azure/ActivityLog/create-or-update-or-delete-sql-server-firewall-rule-alert.html#trendmicro