Azure SQL Database auditing is not configured

Configure Azure SQL auditing to record required database activity.

Description

Choose which Azure SQL operations to audit and at what scope. A server-level policy covers databases on that logical server. Add a database policy if a particular database needs additional coverage.

Potential impact

If neither policy captures an operation, investigators may have no audit record of the connection or data change.

Remediation

Set the server audit policy’s state to Enabled. To send records to Azure Monitor as shown, enable isAzureMonitorTargetEnabled and configure a diagnostic setting on the master database for SQLSecurityAuditEvents and its destination. Perform an operation selected for auditing on the application database and find its record at that destination.

Examples

The second Bicep excerpt adds the server audit policy. Supply the rest of the server configuration and the log destination separately.

Before

bicep
resource sqlServer 'Microsoft.Sql/servers@2023-02-01-preview' = {
  name: 'example-sql-server'
  location: resourceGroup().location
  properties: {}
}

resource sqlDatabase 'Microsoft.Sql/servers/databases@2024-11-01-preview' = {
  parent: sqlServer
  name: 'application'
  location: resourceGroup().location
  properties: {}
}

After

bicep
resource sqlServer 'Microsoft.Sql/servers@2023-02-01-preview' = {
  name: 'example-sql-server'
  location: resourceGroup().location
  properties: {}
}

resource sqlDatabase 'Microsoft.Sql/servers/databases@2024-11-01-preview' = {
  parent: sqlServer
  name: 'application'
  location: resourceGroup().location
  properties: {}
}

resource sqlServerAudit 'Microsoft.Sql/servers/auditingSettings@2024-11-01-preview' = {
  parent: sqlServer
  name: 'default'
  properties: {
    isAzureMonitorTargetEnabled: true
    state: 'Enabled'
  }
}

References