Framework/Configurations/SVT/Services/SQLDatabase.json

{
    "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-AzSqlServerActiveDirectoryAdministrator -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DisplayName '{AzureAdAdmin Display Name}' Refer: https://docs.microsoft.com/en-us/powershell/module/az.sql/set-azsqlserveractivedirectoryadministrator",
      "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-AzSqlDatabaseTransparentDataEncryption -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DatabaseName}' -State 'Enabled'. Refer: https://docs.microsoft.com/en-us/powershell/module/az.sql/set-azsqldatabasetransparentdataencryption *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": {}
      },
      "PolicyDefinitionGuid":"17k78e20-9358-41c9-923c-fb736d382a12",
      "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/17k78e20-9358-41c9-923c-fb736d382a12"
    },
    {
      "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-AzSqlServerAudit -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StorageAccountResourceId '{StorageAccountResourceId}' -BlobStorageTargetState 'Enabled' -RetentionInDays 365'.Refer: https://docs.microsoft.com/en-us/powershell/module/az.sql/set-azsqlserveraudit. Then run command 'Update-AzSqlServerAdvancedThreatProtectionSettings -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StorageAccountName '{StorageAccountName}' -EmailAdmins `$true -ExcludedDetectionType 'None''.",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "Audit",
        "SOX"
      ],
      "Enabled": true,
      "PolicyDefinitionGuid":"36d49e87-48c4-4f2e-beed-ba4ed02b71f5",
      "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/36d49e87-48c4-4f2e-beed-ba4ed02b71f5",
      "FixControl": {
        "FixMethodName": "EnableServerThreatDetection",
        "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. NOTE: While this control does provide an extra layer of access control protection, it may not always be feasible to implement in all scenarios.",
      "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. Note: In case the IP range is indeterminate (for instance, if the client is a PaaS endpoint), you may need to attest this control.",
      "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. NOTE: While this control does provide an extra layer of access control protection, it may not always be feasible to implement in all scenarios.",
      "Recommendation": "Do not configure Any to Any firewall IP address. Run command Remove-AzSqlServerFirewallRule -FirewallRuleName '{AnyToAny FirewallRule Name}' -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}'. Refer: https://docs.microsoft.com/en-us/powershell/module/az.sql/Remove-AzSqlServerFirewallRule",
      "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-AzSqlServerAudit -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -StorageAccountResourceId '{StorageAccountResourceId}' -BlobStorageTargetState 'Enabled' -RetentionInDays $($this.ControlSettings.SqlServer.AuditRetentionPeriod_Min). Refer: https://docs.microsoft.com/en-us/powershell/module/az.sql/set-azsqlserveraudit",
      "Tags": [
        "SDL",
        "TCP",
        "Automated",
        "Audit",
        "SOX"
      ],
      "PolicyDefinitionGuid":"a6fb4358-5bf4-4ad7-ba82-2cd2f41ce5e9",
      "policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/a6fb4358-5bf4-4ad7-ba82-2cd2f41ce5e9",
      "Enabled": true,
      "FixControl": {
        "FixMethodName": "EnableServerAuditingPolicy",
        "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-AzSqlDatabaseDataMaskingRule -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}' -DatabaseName '{DataBaseName}' -SchemaName '{SchemaName}' -TableName '{TableName}' -ColumnName '{ColumnName}'. Refer: https://docs.microsoft.com/en-us/powershell/module/az.sql/set-azsqldatabasedatamaskingrule (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-AzSqlServerFirewallRule -FirewallRuleName 'AllowAllWindowsAzureIps' -ResourceGroupName '{ResourceGroupName}' -ServerName '{ServerName}'. Refer: https://docs.microsoft.com/en-us/powershell/module/az.sql/remove-azsqlserverfirewallrule",
      "Tags": [
        "SDL",
        "Best Practice",
        "Automated",
        "AuthZ",
        "SOX"
      ],
      "Enabled": true
    }
  ]
}