π‘οΈ Azure SQL Server Auditing Retention is less than 90 daysπ’
- Contextual name: π‘οΈ Server Auditing Retention is less than 90 daysπ’
- ID:
/ce/ca/azure/sql-database/server-auditing-retention-90-days-or-more - Tags:
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
RELIABILITY,SECURITY
Logicβ
- π§ prod.logic.yamlπ’
Similar Policiesβ
- Cloud Conformity: SQL Auditing Retention
- Internal:
dec-x-89d5ed7a
Similar Internal Rulesβ
| Rule | Policies | Flags |
|---|---|---|
| βοΈ dec-x-89d5ed7a | 1 |
Descriptionβ
Descriptionβ
SQL Server Audit Retention should be configured to be greater than 90 days.
Rationaleβ
Audit Logs can be used to check for anomalies and give insight into suspected breaches or misuse of information and access.
Auditβ
From Azure Portalβ
- Go to
SQL servers.- For each SQL server, under
Security, clickAuditing.- If
Storageis checked, expandAdvanced properties.- Ensure
Retention (days)is set to a value greater than90, or0for unlimited retention.From PowerShellβ
Get the list of all SQL Servers:
Get-AzSqlServerFor each Server:
Get-AzSqlServerAudit -ResourceGroupName <resource group name> -ServerName <server name>Ensure that
RetentionInDaysis set tomore than 90.Note: If the SQL server is set with
LogAnalyticsTargetStatesetting set toEnabled, run the following additional command:Get-AzOperationalInsightsWorkspace | Where-Object {$_.ResourceId -eq <SQL Server WorkSpaceResourceId>}Ensure that
RetentionInDaysis set tomore than 90.From Azure Policyβ
... see more
Remediationβ
Remediationβ
From Azure Portalβ
- Go to
SQL servers.- For each SQL server, under
Security, clickAuditing.- If
Storageis checked, expandAdvanced properties.- Set
Retention (days)to a value greater than90, or0for unlimited retention.- Click
Save.From PowerShellβ
For each Server, set retention policy to more than 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 more than 90 days> -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>"Blob Storage Exampleβ
... see more