Framework/Configurations/SVT/Services/SQLDatabase.json

{
    "FeatureName": "SQLDatabase",
    "Reference": "aka.ms/azsdktcp/sqldatabase",
    "IsManintenanceMode": 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?view=azurermps-3.8.0",
         "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-AzureRmSqlServerAuditingPolicy -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StorageAccountName '{StorageAccountName}' -EventType 'All' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min) -AuditType 'Blob''.Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqlserverauditingpolicy. 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-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DatabaseName}' -StorageAccountName '{StorageAccountName}' -EventType 'All' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min) -AuditType 'Blob''. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqlserverauditingpolicy. 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_Enable_Firewall",
         "Description": "SQL Server firewall should be enabled",
         "Id": "SQLDatabase180",
         "ControlSeverity": "High",
         "Automated": "Yes",
         "MethodName": "CheckSqlDatabaseFirewallEnabled",
         "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": "Whereever feasible, restrict access to the SQL Server to a limited set of IP addresses/ranges. Run command: New-AzureRmSqlServerFirewallRule -FirewallRuleName '{FirewallRuleName}' -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StartIpAddress '{StartIpAddress}' -EndIpAddress '{EndIpAddress}'. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/new-azurermsqlserverfirewallrule?view=azurermps-3.8.0",
         "Tags": [
            "SDL",
            "TCP",
            "Automated",
            "AuthZ",
            "SOX"
         ],
         "Enabled": true
      },
      {
         "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?view=azurermps-3.8.0",
         "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-AzureRmSqlServerAuditingPolicy -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StorageAccountName '{StorageAccountName}' -EventType 'All' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min) -AuditType 'Blob'. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqlserverauditingpolicy",
         "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-AzureRmSqlDatabaseAuditingPolicy -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DatabaseName}' -StorageAccountName '{StorageAccountName}' -EventType 'All' -AuditType 'Blob' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min). Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/set-azurermsqldatabaseauditingpolicy",
         "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_Deploy_Use_Latest_Version",
         "Description": "Use the latest version for SQL Database that is available",
         "Id": "SQLDatabase110",
         "ControlSeverity": "Low",
         "Automated": "Yes",
         "MethodName": "CheckSqlServerVersionUpgrade",
         "Rationale": "SQL DBs running on older SQL server versions are likely to miss important security updates. This may lead to compromise from various malware/trojan attacks that exploit known vulnerabilities.",
         "Recommendation": "Run command Start-AzureRmSqlServerUpgrade -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -ServerVersion 12.0. Refer: https://docs.microsoft.com/en-us/powershell/module/azurerm.sql/start-azurermsqlserverupgrade?view=azurermps-3.8.0 ",
         "Tags": [
            "SDL",
            "TCP",
            "Automated",
            "Deploy",
            "SOX"
         ],
         "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": "SQLDatabase120",
         "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
      }
   ]
}