Framework/Configurations/SVT/Services/SQLDatabase.json

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
{
    "FeatureName": "SQLDatabase",
    "Reference": "aka.ms/azsktcp/sqldatabase",
    "IsMaintenanceMode": false,
  "Controls": [
    {
      "ControlID": "Azure_SQLDatabase_AuthZ_Use_AAD_Admin",
      "Description": "Enable Azure AD admin for the SQL Database",
      "Id": "SQLDatabase120",
      "ControlSeverity": "High",
      "Automated": "Yes",
      "MethodName": "CheckSqlServerADAdmin",
      "Rationale": "Using the native enterprise directory for authentication ensures that there is a built-in high level of assurance in the user identity established for subsequent access control. All Enterprise subscriptions are automatically associated with their enterprise directory (xxx.onmicrosoft.com) and users in the native directory are trusted for authentication to enterprise subscriptions.",
      "Recommendation": "Run command Set-AzureRmSqlServerActiveDirectoryAdministrator -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DisplayName '{AzureAdAdmin Display Name}' Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqlserveractivedirectoryadministrator",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "AuthZ"
      ],
      "Enabled": true,
      "FixControl": {
        "FixMethodName": "FixADAdmin",
        "FixControlImpact": "High",
        "Parameters": {
          "ActiveDirectoryAdminEmailId": ""
        }
      }
    },
    {
      "ControlID": "Azure_SQLDatabase_DP_Enable_TDE",
      "Description": "Transparent data encryption (TDE) must be enabled",
      "Id": "SQLDatabase150",
      "ControlSeverity": "High",
      "Automated": "Yes",
      "MethodName": "CheckSqlDatabaseTDE",
      "Rationale": "Using this feature ensures that sensitive data is stored encrypted at rest. This minimizes the risk of data loss from physical theft and also helps meet regulatory compliance requirements.",
      "Recommendation": "Run command Set-AzureRmSqlDatabaseTransparentDataEncryption -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DatabaseName}' -State 'Enabled'. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqldatabasetransparentdataencryption *Note:If Blob Auditing or Threat Detection are enabled on the server, they will always apply to the database, regardless of the database level settings.",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "DP",
        "SOX",
        "SqlDatabase"
      ],
      "Enabled": true,
      "FixControl": {
        "FixMethodName": "FixSqlDatabaseTDE",
        "FixControlImpact": "Low",
        "Parameters": {}
      }
    },
    {
      "ControlID": "Azure_SQLDatabase_Audit_Enable_Threat_Detection_Server",
      "Description": "Enable SQL Server threat detection with email admins option. Do not exclude any detection types",
      "Id": "SQLDatabase160",
      "ControlSeverity": "High",
      "Automated": "Yes",
      "MethodName": "CheckSqlServerThreatDetection",
      "Rationale": "Enabling threat detection helps generate alerts about suspicious activity that might indicate attacks such as SQL Injection, login from a new location, unusual usage patterns and related attacks in a timely manner.",
      "Recommendation": "First run command 'Set-AzureRmSqlServerAuditing -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StorageAccountName '{StorageAccountName}' -State 'Enabled' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min)'.Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-AzureRmSqlServerAuditing. Then run command 'Set-AzureRmSqlServerThreatDetectionPolicy -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StorageAccountName '{StorageAccountName}' -EmailAdmins `$true -ExcludedDetectionType 'None''.",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "Audit",
        "SOX"
      ],
      "Enabled": true,
      "FixControl": {
        "FixMethodName": "EnableServerThreatDetection",
        "FixControlImpact": "Low",
        "Parameters": {
          "StorageAccountName": "",
          "SecurityContactEmails": ""
        }
      }
    },
    {
      "ControlID": "Azure_SQLDatabase_Audit_Enable_Threat_Detection_DB",
      "Description": "Enable SQL Database threat detection with email admins option. Do not exclude any detection types",
      "Id": "SQLDatabase170",
      "ControlSeverity": "High",
      "Automated": "Yes",
      "MethodName": "CheckSqlDatabaseThreatDetection",
      "Rationale": "Enabling threat detection helps generate alerts about suspicious activity that might indicate attacks such as SQL Injection, login from a new location, unusual usage patterns and related attacks in a timely manner.",
      "Recommendation": "First run command 'Set-AzureRmSqlDatabaseAuditing -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DatabaseName}' -StorageAccountName '{StorageAccountName}' -State 'Enabled' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min)'. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-AzureRmSqlDatabaseAuditing. Then run command: Set-AzureRmSqlDatabaseThreatDetectionPolicy -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DatabaseName}' -StorageAccountName '{StorageAccountName}' -EmailAdmins `$true -ExcludedDetectionType 'None'. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqldatabasethreatdetectionpolicy.",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "Audit",
        "SOX",
        "SqlDatabase"
      ],
      "Enabled": true,
      "FixControl": {
        "FixMethodName": "EnableDatabaseThreatDetection",
        "FixControlImpact": "Low",
        "Parameters": {
          "StorageAccountName": "",
          "SecurityContactEmails": ""
        }
      }
    },
    {
      "ControlID": "Azure_SQLDatabase_AuthZ_Use_IP_Firewall_Rules_DB",
      "Description": "In a SQL Server with multiple databases, setup firewall rules also at the database level",
      "Id": "SQLDatabase190",
      "ControlSeverity": "High",
      "Automated": "No",
      "MethodName": "",
      "Rationale": "Using the IP firewall rules ensures that access to the data or the service is restricted to a specific set of IPs. While this may not be feasible in all scenarios, when it can be used, it provides an extra layer of access control protection for critical assets and makes your database more portable.",
      "Recommendation": "Wherever feasible, restrict each SQL Database to a limited set of IP addresses/ranges that require access to that database. Refer: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure",
      "Tags": [
        "SDL",
        "TCP",
        "Manual",
        "AuthZ",
        "SqlDatabase"
      ],
      "Enabled": true
    },
    {
      "ControlID": "Azure_SQLDatabase_AuthN_Dont_Use_SQL_AuthN",
      "Description": "Do not use SQL Authentication. Use AAD-authentication instead",
      "Id": "SQLDatabase210",
      "ControlSeverity": "High",
      "Automated": "No",
      "MethodName": "",
      "Rationale": "Using the native enterprise directory for authentication ensures that there is a built-in high level of assurance in the user identity established for subsequent access control. All Enterprise subscriptions are automatically associated with their enterprise directory (xxx.onmicrosoft.com) and users in the native directory are trusted for authentication to enterprise subscriptions.",
      "Recommendation": "Disable SQL Authentication on the DB and use AAD authentication instead. Refer: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-aad-authentication",
      "Tags": [
        "SDL",
        "TCP",
        "Manual",
        "AuthN"
      ],
      "Enabled": true
    },
    {
      "ControlID": "Azure_SQLDatabase_DP_Use_Client_Side_Encryption",
      "Description": "Client-side encryption should be used where appropriate",
      "Id": "SQLDatabase260",
      "ControlSeverity": "Medium",
      "Automated": "No",
      "MethodName": "",
      "Rationale": "Using client-side encryption in 'Always Encrypted' mode helps protect sensitive data at rest on the server, during movement between client and server and ensures that only client applications or app servers that have access to the encryption keys can access plaintext data.",
      "Recommendation": "The recommended client side encryption solution is 'Always Encrypted'. Refer: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-always-encrypted",
      "Tags": [
        "SDL",
        "TCP",
        "Manual",
        "DP"
      ],
      "Enabled": true
    },
    {
      "ControlID": "Azure_SQLDatabase_AuthZ_Grant_Min_Access",
      "Description": "Access to SQL Servers and DBs must be granted in accordance with the principle of least privilege",
      "Id": "SQLDatabase320",
      "ControlSeverity": "Medium",
      "Automated": "No",
      "MethodName": "",
      "Rationale": "Granting minimum access ensures that users are granted just enough permissions to perform their tasks. This minimizes exposure of the resources in case of user/service account compromise.",
      "Recommendation": "Using SSMS Object Explorer and T-SQL to assign database roles, e.g. db_datareader, db_datawriter, db_securityadmin: Alter Role db_datareader ADD MEMBER ApplicationUser; to allow ApplicationUser to read data, Alter Role db_datawriter ADD MEMBER ApplicationUser; to allow ApplicationUser to write data. Refer: https://azure.microsoft.com/en-us/documentation/articles/sql-database-security/#authorization, http://blogs.technet.com/b/scotts-it-blog/archive/2014/09/03/adding-accounts-to-database-roles-in-sql-server-2012.aspx",
      "Tags": [
        "SDL",
        "TCP",
        "Manual",
        "AuthZ"
      ],
      "Enabled": true
    },
    {
      "ControlID": "Azure_SQLDatabase_AuthZ_Configure_IP_Range",
      "Description": "Configure only the required IP addresses on SQL firewall. Do not use Any-to-Any IP range $($this.ControlSettings.UniversalIPRange)",
      "Id": "SQLDatabase360",
      "ControlSeverity": "High",
      "Automated": "Yes",
      "MethodName": "CheckSqlDatabaseFirewallIPAddressRange",
      "Rationale": "Using the firewall feature ensures that access to the data or the service is restricted to a specific set/group of clients. While this may not be feasible in all scenarios, when it can be used, it provides an extra layer of access control protection for critical assets.",
      "Recommendation": "Do not configure Any to Any firewall IP address. Run command Remove-AzureRmSqlServerFirewallRule -FirewallRuleName '{AnyToAny FirewallRule Name}' -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}'. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/remove-azurermsqlserverfirewallrule",
      "Tags": [
        "SDL",
        "Best Practice",
        "Automated",
        "AuthZ",
        "SOX"
      ],
      "Enabled": true
    },
    {
      "ControlID": "Azure_SQLDatabase_Audit_Enable_Logging_and_Monitoring_Server",
      "Description": "Enable SQL Server audit with selected event types and retention period of minimum $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min) days",
      "Id": "SQLDatabase130",
      "ControlSeverity": "Medium",
      "Automated": "Yes",
      "MethodName": "CheckSqlServerAuditing",
      "Rationale": "Auditing enables log collection of important system events pertinent to security. Regular monitoring of audit logs can help to detect any suspicious and malicious activity early and respond in a timely manner.",
      "Recommendation": "Run command Set-AzureRmSqlServerAuditing -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StorageAccountName '{StorageAccountName}' -State 'Enabled' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min). Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-AzureRmSqlServerAuditing",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "Audit",
        "SOX"
      ],
      "Enabled": true,
      "FixControl": {
        "FixMethodName": "EnableServerAuditingPolicy",
        "FixControlImpact": "Low",
        "Parameters": {
          "StorageAccountName": ""
        }
      }
    },
    {
      "ControlID": "Azure_SQLDatabase_Audit_Enable_Logging_and_Monitoring_DB",
      "Description": "Enable SQL Database audit with selected event types and retention period of minimum $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min) days",
      "Id": "SQLDatabase140",
      "ControlSeverity": "Medium",
      "Automated": "Yes",
      "MethodName": "CheckSqlDatabaseAuditing",
      "Rationale": "Auditing enables log collection of important system events pertinent to security. Regular monitoring of audit logs can help to detect any suspicious and malicious activity early and respond in a timely manner.",
      "Recommendation": "Run command Set-AzureRmSqlDatabaseAuditing -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DatabaseName}' -StorageAccountName '{StorageAccountName}' -State 'Enabled' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min). Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-AzureRmSqlDatabaseAuditing",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "Audit",
        "SOX",
        "SqlDatabase"
      ],
      "Enabled": true,
      "FixControl": {
        "FixMethodName": "EnableDatabaseAuditingPolicy",
        "FixControlImpact": "Low",
        "Parameters": {
          "StorageAccountName": ""
        }
      }
    },
    {
      "ControlID": "Azure_SQLDatabase_Audit_Review_Logs_Periodically",
      "Description": "Logs should be reviewed routinely",
      "Id": "SQLDatabase250",
      "ControlSeverity": "Medium",
      "Automated": "No",
      "MethodName": "",
      "Rationale": "Periodic reviews of diagnostics, activity and audit logs ensures that anomalous activity can be identified early enough instead of after a major compromise.",
      "Recommendation": "Use Azure SQL Audit Logs Excel template to review logs. Refer: https://docs.microsoft.com/en-us/azure/sql-database/sql-database-auditing#subheading-3",
      "Tags": [
        "SDL",
        "TCP",
        "Manual",
        "Audit"
      ],
      "Enabled": true
    },
    {
      "ControlID": "Azure_SQLDatabase_DP_Review_Data_Masking_Policy",
      "Description": "Review the Data Masking policy for SQL Database sensitive data columns if in use.",
      "Id": "SQLDatabase370",
      "ControlSeverity": "Medium",
      "Automated": "Yes",
      "MethodName": "CheckSqlServerDataMaskingPolicy",
      "Rationale": "Database dynamic data masking limits sensitive data exposure by masking it to non-privileged users and hides the sensitive data in the result set of a query over designated database fields. When used dynamic data masking should cover all sensitive columns.",
      "Recommendation": "(As applicable) Set Data Masking Rules using the following steps: (1) Run command Set-AzureRmSqlDatabaseDataMaskingRule -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DataBaseName}' -SchemaName '{SchemaName}' -TableName '{TableName}' -ColumnName '{ColumnName}'. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqldatabasedatamaskingrule (2) Verify the privileged users to whom access is granted to view Unmasked data columns.",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "Deploy"
      ],
      "Enabled": true
    },
    {
      "ControlID": "Azure_SQLDatabase_AuthZ_Firewall_Deny_Access_AzureServices",
      "Description": "Use the 'Allow access to Azure services' flag only if required.",
      "Id": "SQLDatabase380",
      "ControlSeverity": "Medium",
      "Automated": "Yes",
      "MethodName": "CheckSqlServerFirewallAccessAzureService",
      "Rationale": "The 'Allow access to Azure services' setting configures a very broad range of IP addresses from Azure as permitted to access the SQL Server. Please make sure your scenario really requires this setting before enabling it. Turning it ON exposes your SQL Server to risk of attacks from resources (IPs) owned by others in the Azure region.",
      "Recommendation": "Turn off the allow access to Azure services flag. Run command Remove-AzureRmSqlServerFirewallRule -FirewallRuleName 'AllowAllWindowsAzureIps' -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}'. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/remove-azurermsqlserverfirewallrule",
      "Tags": [
        "SDL",
        "Best Practice",
        "Automated",
        "AuthZ",
        "SOX"
      ],
      "Enabled": true
    }
  ]
}