Triage and Remediation
Remediation
Using Console
Using Console
To remediate the “Auditing Disabled for SQL Servers” misconfiguration in Azure using the Azure console, follow these steps:
- Log in to the Azure portal (https://portal.azure.com/) using your credentials.
- Navigate to the Azure SQL Server that you want to remediate.
- Click on the “Auditing” option from the left-hand side menu.
- In the “Auditing” blade, click on “Enable Auditing”.
- In the “Audit to” section, select the destination where you want to store the audit logs. You can choose to store the logs in a storage account or log analytics workspace.
- In the “Audit logs retention (days)” section, specify the number of days for which you want to retain the audit logs.
- In the “Event types to audit” section, select the events that you want to audit. You can choose to audit all events or select specific events.
- In the “Storage account settings” or “Log Analytics workspace settings” section, specify the required details for the destination where you want to store the audit logs.
- Click on “Save” to enable auditing for the SQL Server.
- Verify that auditing is enabled by checking the “Auditing” blade. You should see a message that says “Auditing is enabled”.
Using CLI
Using CLI
Here are the step-by-step instructions to remediate the issue of auditing disabled for SQL Servers on Azure using Azure CLI:Note: Replace That’s it! You have successfully remediated the misconfiguration of auditing disabled for SQL Servers on Azure using Azure CLI.
- Open the Azure CLI on your local machine or Azure Cloud Shell.
- Login to your Azure account using the following command:
- Once you are logged in, select the Azure subscription that contains the SQL Server you want to remediate:
- Next, check the current auditing status of the SQL Server using the following command:
- If auditing is disabled, you can enable it by running the following command:
<resource_group_name>
, <server_name>
, <storage_account_name>
, <storage_account_key>
, and <storage_account_endpoint>
with the appropriate values for your environment.- After running the command, wait for a few minutes to allow the changes to propagate.
- Finally, verify that auditing is now enabled for the SQL Server using the following command:
Using Python
Using Python
To remediate the issue of auditing being disabled for SQL Servers in Azure using Python, you can use the Azure SDK for Python. Here are the step-by-step instructions:These steps will enable auditing for the specified SQL Server in Azure using Python.
- Install the Azure SDK for Python using pip:
- Import the necessary modules:
- Authenticate using the default Azure credentials:
- Create a
SqlManagementClient
object:
- Enable auditing for the SQL Server:
- Verify that auditing has been enabled by checking the current state of the security alert policy: