Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server - Windows only
In a high security environment, the Windows Security log is the appropriate location to write events that record object access. Other audit locations are supported but are more subject to tampering.
There are three key requirements for writing SQL Server server audits to the Windows Security log:
The audit object access setting must be configured to capture the events. The audit policy tool (auditpol.exe
) exposes various subpolicies settings in the audit object access category. To allow SQL Server to audit object access, configure the application generated setting.
The account that the SQL Server service is running under must have the generate security audits permission to write to the Windows Security log. By default, the LOCAL SERVICE and the NETWORK SERVICE accounts have this permission. This step isn't required if SQL Server is running under one of those accounts.
Provide full permission for the SQL Server service account to the registry hive HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Security
.
Important
Incorrectly editing the registry can severely damage your system. Before making changes to the registry, we recommend that you back up any valued data on the computer.
Local settings for the Security log can be overwritten by a domain policy. In this case, the domain policy might overwrite the subcategory setting (auditpol /get /subcategory:"application generated"
). SQL Server doesn't have any way to detect that the events it is trying to audit aren't going to be recorded.
Events can be lost if the audit policy is incorrectly configured. The Windows audit policy can affect SQL Server auditing if it is configured to write to the Windows Security log. Typically, the Windows Security log is set to overwrite the older events. This preserves the most recent events. However, if the Windows Security log isn't set to overwrite older events, then if the Security log is full, the system issues Windows event 1104 (Log is full). At that point:
No further security events are recorded
SQL Server can't detect that the system isn't able to record the events in the Security log, resulting in the potential loss of audit events
After the box administrator fixes the Security log, the logging behavior will return to normal.
SQL Server audit records contain significantly more data than regular Windows Event log entries. In addition, depending on the configuration of the audit specification, SQL Server may generate many thousands of audit records in a short period of time (thousands per second). Under periods of high load, this may result in adverse conditions if the audit records are written to either the Application log or the Security log.
These adverse conditions may include:
Rapid cycling of the event log (events are overwritten very quickly as the log file reaches its size limit)
Other applications or services that read from the Windows event log may be negatively affected
The targeted event log may be unusable by administrators due to events being overwritten so quickly
Steps that administrators may take to mitigate these adverse conditions:
Increase the size of the target log (4 GB isn't unreasonable when the audit specification is very detailed).
Reduce the number of events being audited.
Output the audit records to a file instead of the Event Logs.
You must be a Windows administrator to configure these settings.
Open a command prompt with administrative permissions.
From the Start menu, navigate to Command Prompt, and then select Run as administrator.
If the User Account Control dialog box opens, select Continue.
Execute the following statement to enable auditing from SQL Server.
auditpol /set /subcategory:"application generated" /success:enable /failure:enable
Close the command prompt window.
For any Windows operating system, on the Start menu, select Run.
Type secpol.msc
and then select OK. If the User Access Control dialog box appears, select Continue.
In the Local Security Policy tool, navigate to Security Settings > Local Policies > User Rights Assignment.
In the results pane, open Generate security audits.
On the Local Security Setting tab, select Add User or Group.
In the Select Users, Computers, or Groups dialog box, either type the name of the user account, such as domain1\user1 and then select OK, or select Advanced and search for the account.
Select OK.
Close the Security Policy tool.
Restart SQL Server to enable this setting.
If the operating system is earlier than Windows Vista or Windows Server 2008, on the Start menu, select Run.
Type secpol.msc
and then select OK. If the User Access Control dialog box appears, select Continue.
In the Local Security Policy tool, navigate to Security Settings > Local Policies > Audit Policy.
In the results pane, open Audit object access.
On the Local Security Setting tab, in the Audit these attempts area, select both Success and Failure.
Select OK.
Close the Security Policy tool.
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayTraining
Module
Implement Windows Server auditing and diagnostics - Training
Learn to audit and diagnose your Windows Server environment for regulatory compliance, user activity, and troubleshooting. Implement security best practices through regular audits of your network environment to gain early warning of potential malicious activity.
Certification
Microsoft Certified: Security Operations Analyst Associate - Certifications
Investigate, search for, and mitigate threats using Microsoft Sentinel, Microsoft Defender for Cloud, and Microsoft 365 Defender.
Documentation
Create Server Audit & Server Audit Specification - SQL Server
Learn how to create a SQL Server audit and server audit specific using SQL Server Management Studio (SSMS) or Transact-SQL (T-SQL).
SQL Server Audit (Database Engine) - SQL Server
Learn about server audits for the SQL Server Database Engine or an individual database. Server audits contain server and database audit specifications.
Create a server audit & database audit specification - SQL Server
Learn to create a SQL Server audit and a database audit specification by using SQL Server Management Studio or Transact-SQL (T-SQL).