Back to controls

Ensure 'Auditing' Retention is greater than 90 days for SQL Servers

SQL Server Audit Retention should be configured to be greater than 90 days.

Category

Controls

Medium

Applies to

Microsoft Azure

Coverage

1 queries

Asset types

1 covered

Remediation guidance

From the Azure Portal

  1. Go to SQL servers
  2. For each server instance, under Security, select Auditing
  3. Under the Azure SQL Auditing heading, for Storage, click Advanced properties
  4. Set Retention (days) to 90 or more, or 0 for infinite
  5. Select Save

Using Azure PowerShell

For each Server, set the retention policy to more than or equal to 90 days.

Log Analytics Example:

Set-AzSqlServerAudit -ResourceGroupName <resource_group_name> `
  -ServerName  `
  -RetentionInDays <number_greater_than_90> `
  -LogAnalyticsTargetState Enabled `
  -WorkspaceResourceId "/subscriptions/<subscription_ID>/resourceGroups/insightsintegration/providers/Microsoft.OperationalInsights/workspaces/<workspace_name>

Event Hub Example:

Set-AzSqlServerAudit -ResourceGroupName <resource_group_name> `
  -ServerName  `
  -EventHubTargetState Enabled
  -EventHubName <event_Hub name>
  -EventHubAuthorizationRuleResourceId ""

Blob Storage Example:

Set-AzSqlServerAudit -ResourceGroupName <resource_group_name> `
  -ServerName  `
  -RetentionInDays <number_greater_than_90> `
  -BlobStorageTargetState Enabled
  -StorageAccountResourceId "/subscriptions/<subscription_ID>/resourceGroups//providers/Microsoft.Storage/storageAccounts/"

Service-wide remediation

Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.

Azure

Use management group or subscription Azure Policy assignments, remediation tasks where supported, landing-zone standards, and IaC modules so drift is prevented at scale.

Operational rollout

  1. Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
  2. Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
  3. Re-scan and track approved exceptions with an owner and expiry date.

Query logic

These are the stored checks tied to this control.

Azure SQL Servers with audit retention lesser than 90 days

Connectors

Microsoft Azure

Covered asset types

SQLServer

Expected check: eq []

{
  sqlServers(
    where: {
      blobAuditingPolicies_NONE: {
        state: "Enabled"
        OR: [{ retentionDays: 0 }, { retentionDays_GT: 90 }]
      }
    }
  ) {
    ...AssetFragment
  }
}
Cyscale Logo
Cyscale is an agentless cloud-native application protection platform (CNAPP) that automates the contextual analysis of cloud misconfigurations, vulnerabilities, access, and data, to provide an accurate and actionable assessment of risk.

Stay connected

Receive new blog posts and product updates from Cyscale

By clicking Subscribe, I agree to Cyscale’s Privacy Policy


© 2026 Cyscale Limited

LinkedIn icon
Twitter icon
Facebook icon
crunch base icon
angel icon