More Info:
Monitoring for ‘Delete SQL Server Firewall Rule’ events gives insight into network access changes and may reduce the time it takes to detect suspicious activity.Risk Level
LowAddress
Security, Operational MaturityCompliance Standards
ISO27001, HIPAATriage and Remediation
- Remediation
Remediation
Using Console
Using Console
To remediate the misconfiguration “Ensure Activity Log Alert exists for Delete SQL Server Firewall Rule” in Azure using Azure console, follow the below steps:
- Login to Azure portal (https://portal.azure.com/).
- Navigate to the SQL server for which you want to create the activity log alert.
- Under the Security section, click on “Firewalls and virtual networks”.
- Click on the “Activity Log Alerts” tab.
- Click on the “Add Activity Log Alert” button.
- In the “Create Activity Log Alert” window, provide the following details: a. Name: Provide a name for the alert. b. Description: Provide a description for the alert. c. Subscription: Select the subscription in which you want to create the alert. d. Resource Group: Select the resource group in which the SQL server is located. e. Resource Type: Select “Microsoft.Sql/servers/firewallRules” from the dropdown. f. Resource Name: Select the name of the SQL server for which you want to create the alert. g. Alert criteria: Under the “Alert criteria” section, select “Delete” from the “Operation Name” dropdown.
- Under the “Actions” section, select the action you want to perform when the alert is triggered. You can choose to send an email or a webhook notification.
- Click on the “Create Alert” button to create the activity log alert.
Using CLI
Using CLI
To remediate the misconfiguration “Ensure Activity Log Alert exists for Delete SQL Server Firewall Rule” for AZURE using AZURE CLI, you can follow the below steps:Step 1: Login to AZURE CLIStep 2: Check if an activity log alert exists for delete SQL server firewall ruleStep 3: If the output of the above command is empty, create an activity log alert for delete SQL server firewall ruleNote: Replace the This should remediate the misconfiguration “Ensure Activity Log Alert exists for Delete SQL Server Firewall Rule” for AZURE using AZURE CLI.
<subscription-id>, <resource-group-name>, and <action-group-name> with your actual values.Step 4: Verify the activity log alert has been created successfullyUsing Python
Using Python
To remediate this misconfiguration in Azure, we need to create an Activity Log alert for Delete SQL Server Firewall Rule. Here are the step-by-step instructions to do this using Python:
-
Install the Azure SDK for Python using the following command:
-
Import the necessary modules in your Python script:
- Create a Service Principal and assign the required role to it. You can follow the instructions mentioned in this link to create a Service Principal.
-
Authenticate using the Service Principal credentials:
-
Create a Resource Management client object to get the resource group and SQL Server details:
-
Create a Monitor Management client object to create the Activity Log alert:
-
Create a data source for the alert:
-
Create a metric data source for the alert:
-
Create a condition for the alert:
- Create the Activity Log alert:
- Verify that the alert has been created successfully by checking the Azure portal.

