π Azure SQL Server Auditing is not enabled π’
- Contextual name: π Server Auditing is not enabled π’
- ID:
/ce/ca/azure/sql-database/server-auditing
- Located in: π Azure SQL Database
Flagsβ
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
Our Metadataβ
- Policy Type:
COMPLIANCE_POLICY
- Policy Category:
RELIABILITY
SECURITY
Similar Policiesβ
- Cloud Conformity
- Internal
dec-x-36ced3d1
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-x-36ced3d1 | 1 |
Logicβ
- π§ prod.logic.yaml π’
Descriptionβ
Descriptionβ
Enable auditing on SQL Servers.
Rationaleβ
The Azure platform allows a SQL server to be created as a service. Enabling auditing at the server level ensures that all existing and newly created databases on the SQL server instance are audited. Auditing policy applied on the SQL database does not override auditing policy and settings applied on the particular SQL server where the database is hosted.
Auditing tracks database events and writes them to an audit log in the Azure storage account. It also helps to maintain regulatory compliance, understand database activity, and gain insight into discrepancies and anomalies that could indicate business concerns or suspected security violations.
Auditβ
From Azure Portalβ
- Go to
SQL servers
.- For each server instance.
- Under
Security
, clickAuditing
.- Ensure that
Enable Azure SQL Auditing
is set toOn
.From PowerShellβ
Get the list of all SQL Servers:
Get-AzSqlServer
For each Server:
Get-AzSqlServerAudit -ResourceGroupName <ResourceGroupName> -ServerName <SQLServerName>
... [see more](description.md)
Remediationβ
Remediationβ
From Azure Portalβ
- Go to
SQL servers
.- Select the SQL server instance.
- Under
Security
, clickAuditing
.- Click the toggle next to
Enable Azure SQL Auditing
.- Select an Audit log destination.
- Click
Save
.From PowerShellβ
Get the list of all SQL Servers:
Get-AzSqlServer
For each Server, enable auditing and set the retention for at least 90 days.
Log Analytics Exampleβ
Set-AzSqlServerAudit -ResourceGroupName <resource group name> -ServerName <SQL Server name> -RetentionInDays <Number of Days to retain the audit logs, should be 90days minimum> -LogAnalyticsTargetState Enabled -WorkspaceResourceId "/subscriptions/<subscription ID>/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/<workspace name>
Event Hub Exampleβ
Set-AzSqlServerAudit -ResourceGroupName "<resource group name>" -ServerName "<SQL Server name>" -EventHubTargetState Enabled -EventHubName "<Event Hub name>" -EventHubAuthorizationRuleResourceId "<Event Hub Authorization Rule Resource ID>"
... [see more](remediation.md)