Skip to content

Commit 6a6aab1

Browse files
Merge pull request #29970 from markingmyname/valid
[Build Validation] remove warning from link - line 127
2 parents 5fe569c + 0a457f3 commit 6a6aab1

1 file changed

Lines changed: 24 additions & 23 deletions

File tree

docs/relational-databases/security/sql-server-security-best-practices.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "SQL Server security best practices"
3-
description: This topic provides general guidance for securing SQL Server running in an Azure virtual machine.
3+
description: This article provides general guidance for securing SQL Server running in an Azure virtual machine.
44
author: dplessMSFT
55
ms.author: dpless
66
ms.reviewer: "rohitna"
@@ -18,7 +18,9 @@ helpviewer_keywords:
1818
- "strong passwords [SQL Server]"
1919
monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current"
2020
---
21+
2122
# SQL Server security best practices
23+
2224
[!INCLUDE[SQL Server Azure SQL Database Synapse Analytics PDW](../../includes/applies-to-version/sql-asdb-asdbmi.md)]
2325

2426
This article provides information about best practices and guidelines that help establish security for SQL Server. For a comprehensive review of SQL Server security features, see [Securing SQL Server](securing-sql-server.md).
@@ -34,17 +36,17 @@ Azure complies with several industry regulations and standards that can enable y
3436

3537
## Column-level protection
3638

37-
Organizations often need to protect data at the column level as data regarding customers, employees, trade secrets, product data, healthcare, financial, and other sensitive data is often stored in SQL Server databases. Sensitive columns often include identification/social security numbers, mobile phone numbers, first name, family name, financial account identification, and any other data that could be deemed personally identifiable information (PII).
39+
Organizations often need to protect data at the column level as data regarding customers, employees, trade secrets, product data, healthcare, financial, and other sensitive data is often stored in SQL Server databases. Sensitive columns often include identification/social security numbers, mobile phone numbers, first name, family name, financial account identification, and any other data that could be deemed personal data.
3840

3941
The methods and features mentioned in this section raise the level of protection at the column level with minimal overhead, and without requiring extensive changes to application code.
4042

4143
Use [Always Encrypted](encryption/always-encrypted-database-engine.md) to encrypt data at rest and over the wire. Encrypted data is only decrypted by client libraries at the application client level. Use [randomized encryption over deterministic](encryption/always-encrypted-database-engine.md#selecting--deterministic-or-randomized-encryption) where possible. [Always Encrypted (with enclaves)](encryption/always-encrypted-enclaves.md) can improve performance for comparison operations such as [BETWEEN, IN, LIKE, DISTINCT, Joins, and more](encryption/always-encrypted-enclaves.md#confidential-queries) for randomized encryption scenarios.
4244

43-
Use [Dynamic Data Masking (DDM)](dynamic-data-masking.md#creating-a-dynamic-data-mask) to obfuscate data at the column level when Always Encrypted is not an available option. Dynamic Data Masking (DDM) is [not compatible with Always Encrypted](dynamic-data-masking.md#limitations-and-restrictions). Leverage Always Encrypted over dynamic data masking whenever possible.
45+
Use [Dynamic Data Masking (DDM)](dynamic-data-masking.md#creating-a-dynamic-data-mask) to obfuscate data at the column level when Always Encrypted isn't an available option. Dynamic Data Masking (DDM) is [not compatible with Always Encrypted](dynamic-data-masking.md#limitations-and-restrictions). Leverage Always Encrypted over dynamic data masking whenever possible.
4446

45-
You can also [GRANT permissions](../../t-sql/statements/grant-object-permissions-transact-sql.md) at the column level to a table, view, or table-valued function. Consider the following:
47+
You can also [GRANT permissions](../../t-sql/statements/grant-object-permissions-transact-sql.md) at the column level to a table, view, or table-valued function. Consider the following:
4648
- Only SELECT, REFERENCES, and UPDATE permissions can be granted on a column.
47-
- A table-level DENY does not take precedence over a column-level GRANT.
49+
- A table-level DENY doesn't take precedence over a column-level GRANT.
4850

4951
## Row-level protection
5052

@@ -58,7 +60,7 @@ The business logic is encapsulated within table-valued functions controlled by a
5860

5961
## File encryption
6062

61-
[Transparent Data Encryption (TDE)](encryption/transparent-data-encryption.md#enable-tde) protects the data at the file level by providing encryption-at-rest to the database files. Transparent Data Encryption (TDE) ensures that database files, backup files, and tempdb files can't be attached and read without proper certificates decrypting database files. Without Transparent Data Encryption (TDE), it is possible for an attacker to take the physical media (drives or backup tapes) and restore or attach the database to read the contents. Transparent Data Encryption (TDE) is supported to work with all other security capabilities in SQL Server. Transparent Data Encryption (TDE) provides real-time I/O encryption and decryption of the data and log files. TDE encryption leverages a database encryption key (DEK) is stored in the user database. The database encryption key can also be protected using a certificate, which is protected by the database master key of the master database.
63+
[Transparent Data Encryption (TDE)](encryption/transparent-data-encryption.md#enable-tde) protects the data at the file level by providing encryption-at-rest to the database files. Transparent Data Encryption (TDE) ensures that database files, backup files, and tempdb files can't be attached and read without proper certificates decrypting database files. Without Transparent Data Encryption (TDE), it's possible for an attacker to take the physical media (drives or backup tapes) and restore or attach the database to read the contents. Transparent Data Encryption (TDE) is supported to work with all other security capabilities in SQL Server. Transparent Data Encryption (TDE) provides real-time I/O encryption and decryption of the data and log files. TDE encryption leverages a database encryption key (DEK) is stored in the user database. The database encryption key can also be protected using a certificate, which is protected by the database master key of the master database.
6264

6365
Use TDE to protect data at rest, backups, and tempdb.
6466

@@ -67,7 +69,7 @@ Use TDE to protect data at rest, backups, and tempdb.
6769

6870
To [audit SQL Server](auditing/sql-server-audit-database-engine.md), create an audit policy at either the server or database level. Server policies apply to all existing and newly created databases on the server. For simplicity, enable server-level auditing and allow the database-level auditing to inherit the server-level property for all databases.
6971

70-
Audit [tables and columns](auditing/sql-server-audit-database-engine.md) with sensitive data that have security measures applied to them. If a table or column is important enough to need protection by a security capability, then it should be considered important enough to audit. It is especially important to audit and regularly review tables that contain sensitive information but where it is not possible to apply desired security measures due to some kind of application or architectural limitation.
72+
Audit [tables and columns](auditing/sql-server-audit-database-engine.md) with sensitive data that have security measures applied to them. If a table or column is important enough to need protection by a security capability, then it should be considered important enough to audit. It's especially important to audit and regularly review tables that contain sensitive information but where it isn't possible to apply desired security measures due to some kind of application or architectural limitation.
7173

7274

7375
## Identities and authentication
@@ -88,22 +90,22 @@ The following recommendations and best practices help secure your identities and
8890
- It's standard to place Active Directory users in AD groups, AD groups should exist in SQL Server roles, and SQL Server roles should be granted the minimum permissions required by the application.
8991
- In Azure, leverage least-privilege security by using role-based access (RBAC) controls
9092
- Choose Active Directory over SQL Server authentication whenever possible, and especially choose Active Directory over storing the security at the application or database level.
91-
- If a user leaves the company it is easy to disable the account.
92-
- It is also easy to remove users from groups when users change roles or leave the organization. Group security is considered a best practice.
93-
- Leverage [Multi-Factor Authentication](/azure/active-directory/authentication/concept-mfa-howitworks) for accounts that have machine-level access, including accounts that use RDP to log into the machine. This helps guard against credential theft or leaks, as single-factor password-based authentication is a weaker form of authentication with credentials at risk of being compromised or mistakenly given away.
94-
- Require [strong and complex passwords](strong-passwords.md) that cannot be easily guessed, and are not used for any other accounts or purposes. Regularly update passwords and enforce Active Directory policies.
93+
- If a user leaves the company, it's easy to disable the account.
94+
- It's also easy to remove users from groups when users change roles or leave the organization. Group security is considered a best practice.
95+
- Leverage [multifactor authentication](/azure/active-directory/authentication/concept-mfa-howitworks) for accounts that have machine-level access, including accounts that use RDP to log into the machine. This helps guard against credential theft or leaks, as single-factor password-based authentication is a weaker form of authentication with credentials at risk of being compromised or mistakenly given away.
96+
- Require [strong and complex passwords](strong-passwords.md) that can't be easily guessed, and aren't used for any other accounts or purposes. Regularly update passwords and enforce Active Directory policies.
9597

9698
- [Group-Managed Service Accounts (gMSA)](/windows-server/security/group-managed-service-accounts/group-managed-service-accounts-overview) provide automatic password management, simplified service principal name (SPN) management and delegate the management to other administrators.
9799
- With gMSA, the Windows operating system manages passwords for the account instead of relying on the administrator to manage the password.
98100
- gMSA automatically updates the account passwords without restarting services.
99101
- gMSA reduces the administrative surface-level and improves the separation of duties.
100102
- Minimize the rights granted to the AD account of the DBA; Consider a separation of duties that limit access to the virtual machine, the ability to log into the operating system, the ability to modify error and auditing logs, and the ability to install applications and/or features.
101103

102-
- Consider removing DBA accounts from the sysadmin role and granting [CONTROL SERVER](permissions-database-engine.md#chart-of-sql-server-permissions) to DBA accounts rather than making them a member of the sysadmin role. The system admin role does not respect DENY while [CONTROL SERVER](permissions-database-engine.md#chart-of-sql-server-permissions) does.
104+
- Consider removing DBA accounts from the sysadmin role and granting [CONTROL SERVER](permissions-database-engine.md#chart-of-sql-server-permissions) to DBA accounts rather than making them a member of the sysadmin role. The system admin role doesn't respect DENY while [CONTROL SERVER](permissions-database-engine.md#chart-of-sql-server-permissions) does.
103105

104106
## Data lineage and data integrity
105107

106-
Keeping historical records of data changes over time can be beneficial to address accidental changes to the data. It can also be useful for application-change auditing and can provide the ability to recover data elements when a bad actor has introduced data changes that were not authorized.
108+
Keeping historical records of data changes over time can be beneficial to address accidental changes to the data. It can also be useful for application-change auditing and can provide the ability to recover data elements when a bad actor has introduced data changes that weren't authorized.
107109

108110
- Leverage [temporal tables](../../relational-databases/tables/temporal-tables.md) to preserve record versions over time, and to see data as it has been over the record's life span to provide a historical view of your application's data.
109111
- Temporal Tables can be used to supply a version of the current table at any point in time.
@@ -112,19 +114,18 @@ Keeping historical records of data changes over time can be beneficial to addres
112114

113115
The configuration and assessment tools below provide an ability to address surface-area security, identify data security opportunities, and provide a best practice assessment of the security of your SQL Server environment at the instance level.
114116

115-
- [Surface Area Configuration](surface-area-configuration.md) - It is recommended to enable only the features that are required by your environment in order to minimize the number of features that can be attacked by a malicious user.
117+
- [Surface Area Configuration](surface-area-configuration.md) - It's recommended to enable only the features that are required by your environment in order to minimize the number of features that can be attacked by a malicious user.
116118
- [Vulnerability assessment for SQL Server (SSMS)](sql-vulnerability-assessment.md) - SQL vulnerability assessment is a tool in [SSMS v17.4+](../../ssms/download-sql-server-management-studio-ssms.md) that helps discover, track, and remediate potential database vulnerabilities. The vulnerability assessment is a valuable tool to improve your database security and is executed at the database level, per database.
117-
- [SQL Data Discovery and Classification (SSMS)](sql-data-discovery-and-classification.md) - It is common for DBAs to manage servers and databases and not be aware of sensitivity of the data that is contained in the database. Data Discovery & Classification adds the capability to discover, classify, label and report on the sensitivity level of your data. Data Discovery & Classification is supported starting with [SSMS 17.5](../../ssms/download-sql-server-management-studio-ssms.md).
118-
119+
- [SQL Data Discovery and Classification (SSMS)](sql-data-discovery-and-classification.md) - It's common for DBAs to manage servers and databases and not be aware of sensitivity of the data that is contained in the database. Data Discovery & Classification adds the capability to discover, classify, label, and report on the sensitivity level of your data. Data Discovery & Classification is supported starting with [SSMS 17.5](../../ssms/download-sql-server-management-studio-ssms.md).
119120

120121
## Common SQL threats
121122

122123
It helps to know what are some common threats that risk SQL Server:
123124

124125
- [SQL injection](sql-injection.md) - SQL injection is a type of attack where malicious code is inserted into strings that are passed to an instance of SQL Server for execution.
125-
- The injection process works by terminating a text string and appending a new command. Because the inserted command may have additional strings appended to it before it is executed, the attacker terminates the injected string with a comment mark "--".
126-
- SQL Server will execute any syntactically valid query that is received.
127-
- Be aware of [Side-channel attacks](/azure/virtual-machines/mitigate-se), [malware & other threats](/windows/security/threat-protection/intelligence/understanding-malware).
126+
- The injection process works by terminating a text string and appending a new command. Because the inserted command may have additional strings appended to it before it's executed, the attacker terminates the injected string with a comment mark "--".
127+
- SQL Server executes any syntactically valid query that is received.
128+
- Be aware of [Side-channel attacks](/azure/virtual-machines/mitigate-se), [malware & other threats](https://www.microsoft.com/security/business/security-101/what-is-malware).
128129

129130
### SQL injection risks
130131

@@ -139,7 +140,7 @@ To minimize the risk of a SQL injection, consider the following:
139140
- **--** Single-line comment delimiter.
140141
- **/ * ... * /** Comment delimiters.
141142
- **xp_** Catalog-extended stored procedures, such as xp_cmdshell.
142-
- It is not recommended to leverage xp_cmdshell on any SQL Server environment. Use SQLCLR instead or look for other alternatives due to the risks xp_cmdshell may introduce.
143+
- It isn't recommended to leverage xp_cmdshell on any SQL Server environment. Use SQLCLR instead or look for other alternatives due to the risks xp_cmdshell may introduce.
143144
- Always [validate user inputs](sql-injection.md#validate-all-input) and scrub error outputs from being spilled and exposed to the attacker.
144145

145146

@@ -163,9 +164,9 @@ Consider the following common infrastructure threats:
163164

164165
Since you don't want attackers to easily guess account names, or passwords, the following steps help reduce the risk of passwords being discovered:
165166

166-
- Create a unique local administrator account that is not named **Administrator**.
167+
- Create a unique local administrator account that isn't named **Administrator**.
167168
- Use complex strong passwords for all your accounts. For more information about how to create a strong password, see [Create a strong password](https://support.microsoft.com/account-billing/how-to-create-a-strong-password-for-your-microsoft-account-f67e4ddd-0dbe-cd75-cebe-0cfda3cf7386) article.
168-
- By default, Azure selects Windows Authentication during SQL Server virtual machine setup. Therefore, the **SA** login is disabled and a password is assigned by setup. We recommend that the **SA** login should not be used or enabled. If you must have a SQL login, use one of the following strategies:
169+
- By default, Azure selects Windows Authentication during SQL Server virtual machine setup. Therefore, the **SA** login is disabled and a password is assigned by setup. We recommend that the **SA** login shouldn't be used or enabled. If you must have a SQL login, use one of the following strategies:
169170
- Create a SQL account with a unique name that has **sysadmin** membership. You can do this from the portal by enabling **SQL Authentication** during provisioning.
170171

171172
> [!TIP]
@@ -184,7 +185,7 @@ Consider the following to minimize ransomware risks:
184185
- Limit access to the virtual machines
185186
- Require [Just-in-time (JIT) access](/azure/defender-for-cloud/just-in-time-access-usage) and [Azure Bastion](/azure//bastion/bastion-overview)
186187
- Improve Surface Area Security by avoiding installing tools including sysinternals and SSMS on the local machine
187-
- Avoid installing Windows Features, roles and enabling services that are not required
188+
- Avoid installing Windows Features, roles and enabling services that aren't required
188189
- Additionally, there should be a regular full backup scheduled that is separately secured from a common administrator account so it can't delete copies of the databases.
189190

190191
## Next steps

0 commit comments

Comments
 (0)