π 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
- 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-89d5ed7a
Similar Internal Rulesβ
Rule | Policies | Flags |
---|---|---|
βοΈ dec-x-89d5ed7a | 1 |
Logicβ
- π§ prod.logic.yaml π’
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
Storage
is checked, expandAdvanced properties
.- Ensure
Retention (days)
is set to a value greater than90
, or0
for unlimited retention.From PowerShellβ
Get the list of all SQL Servers:
Get-AzSqlServer
For each Server:
Get-AzSqlServerAudit -ResourceGroupName <resource group name> -ServerName <server name>
Ensure that
RetentionInDays
is set tomore than 90
.Note: If the SQL server is set with
LogAnalyticsTargetState
setting set toEnabled
, run the following additional command:Get-AzOperationalInsightsWorkspace | Where-Object {$_.ResourceId -eq <SQL Server WorkSpaceResourceId>}
Ensure that
RetentionInDays
is 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
Storage
is checked, expandAdvanced properties
.- Set
Retention (days)
to a value greater than90
, or0
for 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