Description
For Azure SQL auditing to Blob Storage, retentionDays sets how long audit records are kept. 0 means indefinite retention under this policy.
Potential impact
Records deleted before an investigation starts cannot be recovered by increasing the retention period.
Remediation
Choose a period that covers your audit and investigation needs. Check the storage lifecycle rules, destination permissions and connectivity. Confirm that new records arrive and older ones remain readable. Check other destinations, such as Azure Monitor, separately.
Examples
The excerpts extend retention from 30 to 90 days. Supply the existing sqlDatabase parent and configure an audit destination such as storageEndpoint. Choose the period your organization needs.
Before
resource sqlAudit 'Microsoft.Sql/servers/databases/auditingSettings@2021-02-01-preview' = {
name: 'default'
parent: sqlDatabase
properties: {
state: 'Enabled'
retentionDays: 30
}
}
After
resource sqlAudit 'Microsoft.Sql/servers/databases/auditingSettings@2021-02-01-preview' = {
name: 'default'
parent: sqlDatabase
properties: {
state: 'Enabled'
retentionDays: 90
}
}