6.2 Database Auditing

Key Takeaways

  • Azure SQL Database auditing tracks selected database events to Azure Storage, Log Analytics, and/or Event Hubs for compliance, forensics, and anomaly investigation.
  • Server-level auditing covers all databases on a logical server; database-level auditing scopes a single database—avoid redundant dual enablement that multiplies log volume unless you have a deliberate reason.
  • Azure SQL Managed Instance uses SQL Server Audit patterns (CREATE SERVER AUDIT / specifications) to storage URL or EXTERNAL_MONITOR, plus diagnostic settings for Log Analytics and Event Hubs.
  • Default action groups typically include batch completion and successful/failed database authentication events; tune retention and destinations to investigation and compliance needs.
  • Auditing is the evidence trail; Defender threat alerts are detections—use both: alerts to start investigations, audit logs to prove who ran which statements when.
Last updated: July 2026

Role of Auditing on SC-500

The blueprint calls out Configure database auditing for Azure SQL Database and Azure SQL Managed Instance. Auditing answers: Who did what, on which database, from where, and when? It supports regulatory evidence, insider-threat review, and incident response. It is not the same as Advanced Threat Protection, which raises alerts on suspicious patterns—though both may appear together in secure SQL designs.


Azure SQL Database and Synapse Auditing Overview

Auditing for Azure SQL Database (and Azure Synapse Analytics SQL pools where supported) tracks database events and writes audit records to:

DestinationBest forNotes
Azure StorageLong-term archive, immutable store options, offline reviewAppend blobs; .xel-style audit files; open with SSMS or sys.fn_get_audit_file
Log AnalyticsInteractive KQL, workbooks, Microsoft Sentinel correlationStrong choice for SOC investigation
Event HubsStreaming to third-party SIEM or custom pipelinesNear-real-time export

You can enable multiple destinations. Auditing helps retain trails, report activity, and analyze discrepancies—Microsoft notes it facilitates compliance programs but does not by itself “guarantee” compliance certification.

Performance caveat: Auditing is optimized for database availability. Under extreme load, not every marked event may be recorded. Design critical audits with that resilience trade-off in mind and validate with Defender alerts and platform metrics.


Server-Level vs Database-Level Auditing

ScopeWhat it coversWhen to use
Server (logical server) auditingEvents for databases on that server (modern server audit architecture uses a server-level session capturing all DBs)Default for estate-wide policy: one configuration, consistent coverage
Database auditingSingle databaseDifferent retention/destination per database, heavy OLTP isolation, or exceptions

Practical guidance

  • Enabling server-level auditing is usually enough for “audit everything on this server.”
  • Enabling both server and database auditing for the same events can duplicate records and inflate cost—LinkedIn/field reports and Microsoft large-OLTP guidance warn about volume.
  • For many busy databases, Microsoft recommends considering database-level auditing with reviewed action groups so each DB has its own log folder and queries stay manageable, instead of one enormous shared stream.

Server auditing architecture notes (exam-relevant)

Microsoft re-architected server auditing for Azure SQL Database for reliability alignment with SQL Server/MI patterns:

  • Server audit logs in storage may consolidate under a master folder rather than per-database folder names (older layouts differed).
  • Read-only replica logs may also land in the master folder; filter with replica-related columns when investigating.
  • Viewing certain audit data can require VIEW DATABASE SECURITY AUDIT (and related permissions) in the user database.

You do not need every internal detail memorized, but you should know: scope (server vs database), destinations, and that dual enablement multiplies volume.


What Events Are Captured?

Auditing uses action groups (categories of events). Default configurations commonly emphasize:

Action group (conceptual)Captures
BATCH_COMPLETED_GROUP (and similar batch events)Completed batches—queries and procedure executions
SUCCESSFUL_DATABASE_AUTHENTICATION_GROUPSuccessful logins to the database
FAILED_DATABASE_AUTHENTICATION_GROUPFailed SQL authentication attempts that reach the database

Additional groups exist for permission changes, schema object access, and other security-relevant operations depending on product surface. For Azure Synapse SQL pools, support may be limited to default audit action groups only—another exam nuance.

Important capture nuances

  • Statement length: Audit fields such as statement and data sensitivity information may truncate around 4,000 characters—very long batches are only partially recorded.
  • Temp objects: tempdb/temporary table auditing is constrained; source table activity is the reliable trail for many insert-via-temp patterns.
  • Microsoft Entra failed logins: As noted in platform security, failed Entra authentications may not appear in SQL audit the same way SQL password failures do; check Microsoft Entra sign-in logs.
  • Successful Entra and SQL logins that establish a database session are auditable when the right groups are enabled.

Retention and Immutable Storage

SettingGuidance
SQL Auditing retention (storage)Configure retention days on the audit destination; 0 often means unlimited depending on UI/API
Changing from unlimited to N daysTypically applies to new logs after the change; older unlimited-period blobs may remain
Storage immutabilityUse Azure Storage immutable policies with Allow protected append writes (append blobs / block and append)—None is not valid for SQL audit append patterns
Time-based immutability vs SQL retentionStorage retention interval must be shorter than SQL Auditing retention when combining; unsupported combos include storage policy set while SQL retention is 0
Log Analytics retentionControlled by workspace table retention / commitment tiers—plan cost vs investigation window

Secure the log store independently: storage firewalls/private endpoints, RBAC (Storage Blob Data Contributor for writers such as managed identity scenarios), and separate readers for auditors vs DBAs.

Storage behind VNet/firewall: Prefer general-purpose v2 accounts for audit write patterns Microsoft documents. Authentication mode to storage must match account settings (access keys vs Microsoft Entra / managed identity). If the SQL server has outbound restrictions, allowlist the storage FQDN and re-save auditing configuration after network changes.


Azure SQL Managed Instance Auditing

Managed Instance auditing follows SQL Server Audit more closely than the Database portal experience:

  1. To Azure Storage (URL): Create a private container, establish a credential (historically SAS-based for the container URL), CREATE SERVER AUDIT ... TO URL (PATH=..., RETENTION_DAYS=...), create server or database audit specifications, then ALTER SERVER AUDIT ... WITH (STATE = ON).
  2. To Log Analytics / Event Hubs: Enable diagnostic settings on the MI for SQLSecurityAuditEvents (and DevOps/support operation logs if used), create CREATE SERVER AUDIT ... TO EXTERNAL_MONITOR, specifications, then enable the audit.
  3. Microsoft Support operations auditing: Optional separate server audit that records Microsoft support engineer operations during support cases—enable deliberately; enabling the checkbox on an existing audit can overwrite intent so only support ops are logged.

Differences vs SQL Server on-prem exist (URL targets, EXTERNAL_MONITOR, cloud identity patterns). For SC-500, remember: MI = SQL Audit objects + diagnostics, Database = auditing blade with Storage/LA/EH destinations, both produce investigation evidence.


Using Audit Logs for Investigations

Typical investigation flow

  1. Trigger: Defender for SQL alert, user report, or compliance sampling request.
  2. Scope time window and identity: UPN, client IP, application name, database name.
  3. Query the right store:
    • Log Analytics: search SQLSecurityAuditEvents / AzureDiagnostics audit categories; filter by LogicalServerName, database_name, client_ip, principal.
    • Storage: browse container hierarchy or sys.fn_get_audit_file against blob paths.
    • Event Hubs: downstream SIEM correlation with Entra and NSG/Firewall logs.
  4. Correlate: Pair SQL batches with Entra sign-ins, Key Vault access (if secrets used), and app logs.
  5. Contain: Disable principal, rotate credentials, tighten firewall/private access, revoke roles.
  6. Preserve evidence: Export relevant audit ranges; verify retention will not age them out mid-case.

Example investigation questions audit can answer

QuestionAudit evidence
Did this login succeed last night?Authentication success events + timestamp/IP
Who dropped a table?DDL/batch events with principal and statement
Was there mass SELECT before exfiltration alert?Batch completed events volume by principal
Did a support engineer touch the MI?Support operations audit (if enabled)

Scenario: SOC receives a SQL injection alert from Defender for SQL on sqldb-orders. They open Log Analytics for the server’s audit diagnostic, filter the database and the 15-minute window, find repeated batches with tautology patterns from an app managed identity—and also interactive batches from a human Entra user who should only use the portal. Outcome: fix the app parameterization, revoke the human’s elevated role, confirm server audit retention ≥ 90 days for the regulator, and keep Defender enabled.

SC-500 Exam Traps (Auditing)

  • Auditing ≠ threat protection; one records, one detects.
  • Server vs database scope: know coverage and duplication risk.
  • Destinations are Storage, Log Analytics, Event Hubs—not “only Activity Log.”
  • MI configuration is not identical to Database portal toggles.
  • Failed Entra logins may require Entra logs, not only SQL audit.
  • Immutable storage for audit needs append write allowance.
Test Your Knowledge

You need a single configuration that records audit events for every database on an Azure SQL logical server to a Log Analytics workspace for Sentinel. What should you enable?

A
B
C
D
Test Your Knowledge

How does Azure SQL Managed Instance auditing primarily differ from Azure SQL Database auditing configuration?

A
B
C
D
Test Your Knowledge

An investigator cannot find a failed Microsoft Entra sign-in attempt in Azure SQL Database audit logs, but the user insists they were blocked. What is the best next place to look?

A
B
C
D
Test Your Knowledge

You must keep Azure SQL audit blobs tamper-evident for regulators. Which storage configuration is compatible with SQL auditing append patterns?

A
B
C
D