Skip to main content
Microsoft Defenderintermediate

Microsoft Defender for Endpoint Exclusions for SQL Server

Configure Microsoft Defender for Endpoint exclusions for SQL Server to prevent performance issues, file locking, and database engine conflicts.

12 min readUpdated April 2026

Want us to handle this for you?

Get expert help →

Why SQL Server Needs Defender Exclusions

SQL Server relies on low latency access to data and log files. Microsoft Defender for Endpoint performs real-time inspection of file operations to identify malicious patterns. This inspection introduces a slight delay in every I/O request. For a high performance database, these small delays aggregate into significant performance loss.

The primary conflict arises from file locking. When SQL Server attempts to write to a database file, the antivirus engine may be reading it for a scan. This leads to sharing violations. You will see these recorded in the SQL Server error log as Operating System Error 32.

System stability is also at risk. If the security agent locks a transaction log file during a critical write, the database engine may mark the database as suspect. This can lead to unexpected downtime. Proper exclusions ensure that the security agent skips these known safe, high volume files.

Administrators manage exclusions through the Microsoft Defender portal. Visit security.microsoft.com and sign in with an account that has security administrator permissions. Navigation starts at the bottom of the left sidebar.

Click on Settings and then select Endpoints. This opens the configuration area for all managed devices. Look for the Configuration management group in the middle of the page. Select the Exclusions option within this group.

The Exclusions page displays all current active rules. Click the Add exclusion button to create a new entry. You will see a panel open on the right side of the screen. This panel contains a dropdown menu for the exclusion type.

You can choose between File, Folder, Extension, or Process. The portal requires you to enter the value exactly as it appears on the target server. After entering the detail, click Add and then Save to apply the change to your environment.

The Actual Exclusion List

The following list follows official vendor recommendations for a standard SQL Server installation. Adjust paths based on your specific instance names and drive configurations.

Process Exclusions

Excluding processes is often more effective than excluding individual files. When you exclude a process, Defender ignores the file operations performed by that executable.

  1. %ProgramFiles%\Microsoft SQL Server\MSSQLnn.InstanceName\MSSQL\Binn\sqlservr.exe
  2. %ProgramFiles%\Microsoft SQL Server\MSSQLnn.InstanceName\MSSQL\Binn\sqlagent.exe
  3. %ProgramFiles%\Microsoft SQL Server\MSSQLnn.InstanceName\MSSQL\Binn\fdlauncher.exe

The variable nn represents the SQL version number. For example, SQL Server 2022 uses MSSQL16. The InstanceName is usually MSSQLSERVER for default instances.

File Extension Exclusions

Add extension based exclusions as a secondary layer of protection. This covers files that might be moved or placed in non standard directories.

  • .mdf: The primary data file for the database.
  • .ldf: The transaction log file.
  • .ndf: Secondary data files used for partitioning.
  • .bak: Database backup files.
  • .trn: Transaction log backup files.

Folder and Directory Exclusions

Identify every directory where SQL Server stores data. This includes local drives, storage area network volumes, and mount points.

Exclude the main data directory. This is typically C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Data. Also exclude the log directory if it is stored in a separate location.

TempDB exclusions are mandatory. TempDB is the most active database in many environments. Frequent scanning of tempdb.mdf and templog.ldf will cause immediate and visible performance degradation.

Exclude the backup directory. Backup operations involve sustained, heavy writes. If the security agent scans these files during the backup process, the operation may fail. It will also consume excessive CPU resources on the server.

Verification Steps

Once you apply the changes in the portal, you must confirm they reached the server. Propagation can take several minutes or longer depending on your sync interval.

Using PowerShell

PowerShell is the fastest way to check the local configuration. Open a terminal as an administrator and run the command: Get-MpPreference.

Review the output for three specific fields. ExclusionPath contains your folder and file paths. ExclusionProcess shows your executable files. ExclusionExtension lists your file types. Ensure the paths match your SQL Server environment exactly.

Event Viewer Analysis

The Windows Event Viewer records every configuration change made to the antivirus engine. Open Event Viewer and navigate to Applications and Services Logs. Expand Microsoft, then Windows, and finally Windows Defender.

Click on the Operational log. Filter the log for Event ID 5007. This event indicates that a setting was changed. The details will show the exclusion that was added. You can also look for Event ID 1116 to see if any recent scans were blocked by these new rules.

Common Pitfalls

One frequent error is the use of environmental variables. Microsoft Defender for Endpoint does not always resolve all system variables correctly in the portal. It is safer to use the full literal path for your exclusions.

Do not rely on the default paths provided in documentation. Many enterprises install SQL Server on the D or E drives. If your exclusion points to the C drive while your data is on the D drive, the security agent will continue to scan your active databases.

Permissions can also cause issues. If the system account does not have read access to the directory, the exclusion mechanism might fail. Verify that the folders have inherited the correct permissions from the parent drive.

Another mistake is excluding the wrong process. Some administrators exclude the SQL Server Management Studio process instead of the Database Engine process. SSMS is a client tool and does not handle the primary I/O operations of the database.

Authoritative Documentation Sources

The definitive source for Microsoft Defender for Endpoint configuration is https://learn.microsoft.com/en-us/defender-endpoint/. This documentation covers the latest portal updates and policy management techniques.

For database specific guidance, visit the Microsoft SQL Server support pages. They maintain a list of antivirus best practices. This list is updated whenever a new version of the database engine is released.

Always consult the section regarding clustered instances if you are running a Failover Cluster Instance. Clustered environments require additional exclusions for the quorum drive and witness folders. Failure to exclude these can lead to cluster node evictions.

Maximize Your Defender Investment

Our MDR team monitors your Microsoft Defender environment 24/7 and responds to threats before they become incidents.