Skip to main content

More Info:

Enable alerts related to threat detections.

Risk Level

Medium

Address

Security

Compliance Standards

  • CIS AZURE
  • Cloudanix Best Practice
  • HITRUST CSF
  • NIST CSF
  • PCI
  • SOC2

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration “Threat Detection Alerts Disabled for SQL Databases” in Azure using the Azure console, follow these steps:
  1. Log in to the Azure portal (https://portal.azure.com/).
  2. Navigate to the Azure SQL Database that has the misconfiguration.
  3. Click on the “Security” tab in the left-hand menu.
  4. Click on the “Advanced Data Security” option.
  5. Click on the “Configure advanced data security” button.
  6. In the “Advanced Data Security” blade, toggle the “Threat detection” option to “On”.
  7. Select the “Send alerts to” option and provide an email address to receive the alerts.
  8. Set the “Alerts” threshold to the desired level.
  9. Click on the “Save” button to save the changes.
Once you have completed these steps, threat detection alerts will be enabled for the Azure SQL Database and you will receive alerts when any threats are detected.

To remediate the misconfiguration of Threat Detection Alerts Disabled for SQL Databases in AZURE using AZURE CLI, please follow the below steps:Step 1: Open the AZURE CLI in your system.Step 2: Log in to your AZURE account using the below command:
Step 3: After logging in, set the subscription where your SQL databases are located using the below command:
Step 4: To enable Threat Detection Alerts for SQL databases, you need to enable the Advanced Threat Protection (ATP) service. You can enable this service by running the following command:
Note: Replace the placeholders with the actual values of your resource group name, server name, storage account name, storage account key, and workspace resource ID.Step 5: After enabling the ATP service, you can enable Threat Detection Alerts for your SQL databases by running the following command:
Note: Replace the placeholders with the actual values of your resource group name, server name, and database name.Step 6: Verify that the Threat Detection Alerts are enabled for your SQL databases by running the following command:
Note: Replace the placeholders with the actual values of your resource group name, server name, and database name.Once you follow the above steps, Threat Detection Alerts will be enabled for your SQL databases in AZURE.
To remediate the misconfiguration of threat detection alerts being disabled for SQL databases in Azure using Python, you can follow the below steps:Step 1: Import the necessary libraries and authenticate to Azure using the Azure SDK for Python.
Step 2: Get the resource group name and SQL server name where the database is located.
Step 3: Get the list of SQL databases in the specified server.
Step 4: For each database in the list, check if the threat detection policy is enabled. If not, enable it.
Step 5: Run the Python script to remediate the misconfiguration.Note: Make sure to install the necessary libraries using pip before running the script.
This change does not replace existing databases or the SQL server; it only creates/updates the server’s security alert policy, which applies to all databases on that server.To verify, terraform plan should show a new azurerm_mssql_server_security_alert_policy.sql_server_threat_detection resource with state = "Enabled" and the configured email_account_admins / email_addresses, and no planned replacements of your azurerm_mssql_server or azurerm_mssql_database resources.