how-to-disable-sql-server-sa-account
# How to Disable SQL Server SA Account and Create New Admin Account
The **sa (System Administrator)** account in SQL Server is a well-known, built-in account with unrestricted access to the database engine. Due to its predictable name and elevated privileges, the sa account is a primary target for brute-force attacks and unauthorized access attempts[web:13][web:14]. This guide demonstrates how to secure your SQL Server by disabling the sa account and creating alternative administrative accounts.
## Why Disable the SA Account?
### Security Risks
- **Well-known target**: Like the Windows Administrator account, attackers know the sa account exists on every SQL Server instance
- **Cannot be locked out**: Unlike regular accounts, sa cannot be locked after failed login attempts, making it vulnerable to brute-force attacks
- **High privileges**: The sa account has full system administrator rights, providing complete control over the SQL Server instance
### Best Practice
Microsoft and security experts recommend disabling the sa account and using Windows Authentication or individual SQL logins with sysadmin privileges instead.
## Method 1: Create a New Admin Account
Before disabling sa, create an alternative administrator account to maintain administrative access.
### Using SQL Server Management Studio (SSMS)
**Step 1: Connect to SQL Server**
- Open SSMS and connect using an account with administrative privileges
**Step 2: Navigate to Security**
- In Object Explorer, expand your server instance
- Expand the **Security** folder
- Right-click **Logins** and select **New Login**
**Step 3: Configure Login Details**
- Enter a username in the **Login name** field (e.g., `sql_admin`)
- Select **SQL Server authentication**
- Enter a strong password and confirm it
- Optionally, uncheck **Enforce password expiration** if required by your policy
**Step 4: Assign Sysadmin Role**
- Click **Server Roles** in the left menu
- Check the **sysadmin** checkbox
- Click **OK**
### Using T-SQL
```sql
-- Create a new login with SQL Server authentication
CREATE LOGIN [sql_admin] WITH PASSWORD = 'YourStrongPassword123!';
-- Add the login to the sysadmin server role
ALTER SERVER ROLE [sysadmin] ADD MEMBER [sql_admin];
-- Verify the account has sysadmin privileges
SELECT IS_SRVROLEMEMBER('sysadmin', 'sql_admin');
-- Should return 1 (true)
Using Windows Authentication (Recommended)
-- Create a Windows login
CREATE LOGIN [DOMAIN\AdminUser] FROM WINDOWS;
-- Add to sysadmin role
ALTER SERVER ROLE [sysadmin] ADD MEMBER [DOMAIN\AdminUser];
-- Verify privileges
SELECT IS_SRVROLEMEMBER('sysadmin', 'DOMAIN\AdminUser');
Method 2: Disable the SA Account
Once you have an alternative admin account and verified it works, disable the sa account.
Using SSMS GUI
Step 1: Locate SA Account
- Expand Security → Logins
- Right-click the sa login
- Select Properties
Step 2: Disable the Account
- Go to the Status page
- Under Login, select Disabled
- Click OK
Using T-SQL
-- Disable the sa account
ALTER LOGIN [sa] DISABLE;
-- Verify the account is disabled
SELECT name, is_disabled
FROM sys.server_principals
WHERE name = 'sa';
-- is_disabled = 1 means disabled, 0 means enabled
Method 3: Rename SA Account (Additional Security Layer)
For enhanced security, consider renaming the sa account before disabling it.
-- Check if the login is the original sa account (SID should be 0x01)
SELECT name, sid
FROM sys.server_principals
WHERE sid = 0x01;
-- Rename the sa account
ALTER LOGIN [sa] WITH NAME = [sa_disabled_old];
-- Disable the renamed account
ALTER LOGIN [sa_disabled_old] DISABLE;
Verify Changes
Test your new admin account and confirm sa is disabled:
-- Check sa account status
SELECT
name,
is_disabled,
create_date,
modify_date
FROM sys.server_principals
WHERE name IN ('sa', 'sql_admin', 'sa_disabled_old');
-- Verify your new admin has sysadmin role
SELECT
sp.name AS LoginName,
sp.type_desc AS LoginType,
sr.name AS ServerRole
FROM sys.server_principals sp
JOIN sys.server_role_members srm ON sp.principal_id = srm.member_principal_id
JOIN sys.server_principals sr ON srm.role_principal_id = sr.principal_id
WHERE sp.name = 'sql_admin';
What Still Works After Disabling SA?
Disabling the sa account does not break these functionalities:
- Database ownership: Databases owned by sa continue to function normally
- SQL Agent jobs: Jobs owned by sa still execute
- Schema ownership: Schemas owned by sa remain operational
- Impersonation: Internal processes can still impersonate sa
- System databases: Master, tempdb, and other system databases with sa as owner work correctly
Important Considerations
Emergency Access
Create a "break-glass" emergency admin account with a strong random password stored in a secure vault:
-- Create emergency admin account
CREATE LOGIN [emergency_admin] WITH PASSWORD = 'StrongRandomPassword20+Chars';
ALTER SERVER ROLE [sysadmin] ADD MEMBER [emergency_admin];
Service Packs and Updates
In rare cases, SQL Server updates may have issues with a disabled sa account. Best practice:
- Before update: Re-enable and rename sa back to its original name
- Apply update: Install Service Pack or Cumulative Update
- After update: Rename and disable sa again
-- Before update
ALTER LOGIN [sa_disabled_old] WITH NAME = [sa];
ALTER LOGIN [sa] ENABLE;
-- After update
ALTER LOGIN [sa] WITH NAME = [sa_disabled_old];
ALTER LOGIN [sa_disabled_old] DISABLE;
Cannot Drop SA
You cannot drop the sa account, and it inherently retains sysadmin privileges even when disabled. The secure pattern is to leave it in sysadmin but disable it.
Security Best Practices
- Use Windows Authentication: Prefer Windows or Azure AD (Entra ID) authentication over SQL authentication when possible
- Strong passwords: Use complex passwords with 20+ characters for any SQL logins
- Least privilege: Create separate accounts for each DBA instead of sharing admin credentials
- Regular audits: Periodically check for unauthorized logins or re-enabled sa accounts
- Disable unused features: Turn off xp_cmdshell, OLE Automation, and other risky features
- Monitor login attempts: Set up alerts for failed login attempts on admin accounts
Conclusion
Disabling the SQL Server sa account is a fundamental security measure that protects your database from brute-force attacks and unauthorized access. By creating individual administrative accounts with proper authentication methods and disabling the well-known sa login, you significantly reduce your SQL Server's attack surface[web:13][web:17][web:18]. Always test your alternative admin accounts before disabling sa, and maintain a documented emergency access procedure for critical situations.
```