SQL Server Hardening Checklist: 20 Steps to Secure Your Database

SQL Server Hardening Checklist: 20 Steps to Secure Your Database

SQL Server often holds a business’s most valuable data: customers, invoices, payroll and line-of-business applications. It’s also frequently installed once by a software vendor and never looked at again. This checklist covers 20 practical steps to harden Microsoft SQL Server 2019, 2022 and 2025 on Windows.

Before you start: many small business databases are installed and supported by a software vendor. Check with them before changing logins, ports or permissions, and test changes outside working hours with a fresh backup.

1. Installation and patching

1. Install only the features you need

Database Engine is usually enough. Remove unused components such as Reporting Services, Analysis Services, Integration Services, Full-Text Search or Machine Learning Services if nothing uses them.

2. Keep SQL Server on a supported version and patched

Install the latest cumulative update (CU) and security updates. SQL Server versions that are out of extended support no longer receive security fixes. Check your version:

SELECT @@VERSION;

3. Run SQL Server on a dedicated, hardened server

Avoid installing SQL Server on a domain controller or a file server used by everyone. Apply the Windows Server hardening checklist to the host first.

4. Use low-privilege service accounts

Run the SQL Server and SQL Agent services under a virtual account, managed service account (gMSA) or dedicated low-privilege domain account, never under a domain admin or the local administrator account.

2. Authentication and logins

5. Prefer Windows authentication

Windows authentication uses Active Directory and Kerberos, with your existing password policy and MFA options. Use Windows authentication mode if your applications support it. If they need SQL logins, use mixed mode and protect those logins carefully.

6. Disable or rename the sa account

The sa login is the first thing attackers try. If you don’t need it, disable it. If you use mixed mode, at least rename it and give it a long random password.

ALTER LOGIN sa DISABLE;
-- or
ALTER LOGIN sa WITH NAME = [db_breakglass_admin];

7. Enforce password policy on SQL logins

Make sure SQL logins follow Windows password policy:

SELECT name, is_policy_checked, is_expiration_checked, is_disabled
FROM sys.sql_logins;

Turn on CHECK_POLICY for every SQL login.

8. Review sysadmin members

Few people and services should be sysadmin:

SELECT p.name, p.type_desc
FROM sys.server_role_members rm
JOIN sys.server_principals p ON rm.member_principal_id = p.principal_id
WHERE rm.role_principal_id = SUSER_ID('sysadmin');

Remove anyone who doesn’t need it. Applications should almost never run as sysadmin.

9. Give applications least-privilege database users

Each application should have its own login with access only to its own database, using roles such as db_datareader and db_datawriter or specific permissions, rather than db_owner.

10. Remove orphaned and unused logins

Remove logins for former staff, old applications and test accounts. Check for orphaned users in each database with:

EXEC sp_change_users_login 'Report';

(On newer versions, compare sys.database_principals with sys.server_principals.)

3. Surface area

11. Disable xp_cmdshell and other risky features

xp_cmdshell lets SQL commands run operating system commands, which attackers love. Make sure it’s off, along with OLE Automation and CLR unless you need them:

SELECT name, value_in_use FROM sys.configurations
WHERE name IN ('xp_cmdshell','Ole Automation Procedures','clr enabled','Ad Hoc Distributed Queries','remote admin connections');

value_in_use should be 0 for features you don’t use.

12. Disable the SQL Browser service if not needed

If clients connect using a fixed port, you don’t need SQL Server Browser (UDP 1434). Disable it in SQL Server Configuration Manager.

13. Remove sample databases

Delete sample databases such as AdventureWorks or Northwind from production servers.

4. Network exposure

14. Never expose SQL Server to the internet

Port 1433 open to the internet attracts constant brute-force attacks. Access from outside should go through a VPN or application server. Check your firewall for any port forward to 1433.

15. Restrict access with Windows Firewall

Allow SQL Server’s port only from the application servers and admin workstations that need it, not from the whole network.

16. Encrypt connections

Install a certificate from a trusted CA and enable Force Encryption (or “Force Strict Encryption” on SQL Server 2022 and later) so data and logins are encrypted in transit. Test application compatibility first, because older clients may need updated drivers.

5. Data protection

17. Use Transparent Data Encryption for sensitive databases

TDE encrypts database files and backups at rest, protecting them if disks or backup files are stolen. Back up the certificate and private key separately and securely. Without them, encrypted backups can’t be restored.

18. Encrypt backups

Use WITH ENCRYPTION in backup commands or your backup tool’s encryption, and store keys separately from the backups.

6. Auditing and recovery

19. Audit logins and permission changes

At minimum, record failed logins and changes to logins and roles. SQL Server Audit can write to the Windows Security log or files:

  • Failed logins (FAILED_LOGIN_GROUP)
  • Successful logins for admin accounts
  • Server role and permission changes (SERVER_ROLE_MEMBER_CHANGE_GROUP, SERVER_PERMISSION_CHANGE_GROUP)

Forward these logs to your central log system.

20. Back up regularly, off the server, and test restores

  • Full backups at least daily, with transaction log backups for databases in FULL recovery model
  • Copies stored off the server, with at least one offline or immutable copy
  • Regular test restores to confirm backups work, and that you know how long a restore takes

See our small business backup strategy guide.

SQL Server hardening checklist (summary)

AreaCheck
InstallOnly needed features; supported version; latest CU
HostDedicated, hardened Windows Server; low-privilege service accounts
AuthenticationWindows auth preferred; sa disabled or renamed; password policy on SQL logins
PermissionsFew sysadmins; least-privilege app logins; unused logins removed
Surface areaxp_cmdshell, OLE, CLR off; Browser off; sample DBs removed
NetworkNot internet-exposed; firewall restricted; connections encrypted
DataTDE for sensitive data; certificates backed up; backups encrypted
MonitoringAudits for failed logins and permission changes; logs forwarded
RecoveryDaily backups; off-server copies; tested restores

For the operating system underneath, see our Windows Server 2025 hardening checklist.