π‘οΈ 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 {{sql-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-workspace-resource-id}}}Ensure that
RetentionInDaysis set tomore than 90.... 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 {{retention-days-min-90}} `
-LogAnalyticsTargetState Enabled `
-WorkspaceResourceId "/subscriptions/{{subscription-id}}/resourceGroups/{{resource-group-name}}/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)