Project: KICS (Provisioning / Security & Compliance)
File: 89b79fe5-49bd-4d39-84ce-55f5fc6f7764.md

title: SQL Alert Policy Without Emails hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: 89b79fe5-49bd-4d39-84ce-55f5fc6f7764 Query name: SQL Alert Policy Without Emails Platform: AzureResourceManager Severity: <span style="color:#5bc0de">Info</span> Category: Best Practices URL: SQL Database Server should contain emails to be notified in the event of a Security Alert<br> ```json title="Positive test num. 1 - json file" hl_lines="46" { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "functions": [], "variables": {}, "resources": [ { "name": "sqlServer1", "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlServer1" }, "properties": { "administratorLogin": "adminUsername", "administratorLoginPassword": "adminPassword" }, "resources": [ { "name": "sqlServer1/sqlDatabase1", "type": "Microsoft.Sql/servers/databases", "apiVersion": "2014-04-01", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlDatabase1" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "collation": "SQLLatin1GeneralCP1CI_AS", "edition": "Basic", "maxSizeBytes": "1073741824", "requestedServiceObjectiveName": "Basic" } }, { "type": "Microsoft.Sql/servers/databases/securityAlertPolicies", "apiVersion": "2021-02-01-preview", "name": "sqlServer1/sqlDatabase1/securityPolicy1", "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "emailAccountAdmins": true, "retentionDays": 4, "state": "Enabled" } } ] } ], "outputs": {} } ``` ```json title="Positive test num. 2 - json file" hl_lines="48" { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "functions": [], "variables": {}, "resources": [ { "name": "sqlServer1", "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlServer1" }, "properties": { "administratorLogin": "adminUsername", "administratorLoginPassword": "adminPassword" }, "resources": [ { "name": "sqlServer1/sqlDatabase1", "type": "Microsoft.Sql/servers/databases", "apiVersion": "2014-04-01", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlDatabase1" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "collation": "SQLLatin1GeneralCP1CI_AS", "edition": "Basic", "maxSizeBytes": "1073741824", "requestedServiceObjectiveName": "Basic" } }, { "type": "Microsoft.Sql/servers/databases/securityAlertPolicies", "apiVersion": "2021-02-01-preview", "name": "sqlServer1/sqlDatabase1/securityPolicy1", "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "emailAccountAdmins": true, "emailAddresses": [], "retentionDays": 4, "state": "Enabled" } } ] } ], "outputs": {} } ``` ```json title="Positive test num. 3 - json file" hl_lines="48" { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "functions": [], "variables": {}, "resources": [ { "name": "sqlServer1", "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlServer1" }, "properties": { "administratorLogin": "adminUsername", "administratorLoginPassword": "adminPassword" }, "resources": [ { "name": "sqlServer1/sqlDatabase1", "type": "Microsoft.Sql/servers/databases", "apiVersion": "2014-04-01", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlDatabase1" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "collation": "SQLLatin1GeneralCP1CI_AS", "edition": "Basic", "maxSizeBytes": "1073741824", "requestedServiceObjectiveName": "Basic" } }, { "type": "Microsoft.Sql/servers/databases/securityAlertPolicies", "apiVersion": "2021-02-01-preview", "name": "sqlServer1/sqlDatabase1/securityPolicy1", "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "emailAccountAdmins": true, "emailAddresses": [ "", "" ], "retentionDays": 4, "state": "Enabled" } } ] } ], "outputs": {} } ``` <details><summary>Positive test num. 4 - json file</summary> ```json hl_lines="48" { "properties": { "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "functions": [], "variables": {}, "resources": [ { "name": "sqlServer1", "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlServer1" }, "properties": { "administratorLogin": "adminUsername", "administratorLoginPassword": "adminPassword" }, "resources": [ { "name": "sqlServer1/sqlDatabase1", "type": "Microsoft.Sql/servers/databases", "apiVersion": "2014-04-01", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlDatabase1" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "collation": "SQLLatin1GeneralCP1CI_AS", "edition": "Basic", "maxSizeBytes": "1073741824", "requestedServiceObjectiveName": "Basic" } }, { "type": "Microsoft.Sql/servers/databases/securityAlertPolicies", "apiVersion": "2021-02-01-preview", "name": "sqlServer1/sqlDatabase1/securityPolicy1", "dependsOn": [

'sqlServer1')]" ], "properties": { "emailAccountAdmins": true, "retentionDays": 4, "state": "Enabled" } } ] } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` </details> <details><summary>Positive test num. 5 - json file</summary> ```json hl_lines="50" { "properties": { "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "functions": [], "variables": {}, "resources": [ { "name": "sqlServer1", "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlServer1" }, "properties": { "administratorLogin": "adminUsername", "administratorLoginPassword": "adminPassword" }, "resources": [ { "name": "sqlServer1/sqlDatabase1", "type": "Microsoft.Sql/servers/databases", "apiVersion": "2014-04-01", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlDatabase1" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "collation": "SQLLatin1GeneralCP1CI_AS", "edition": "Basic", "maxSizeBytes": "1073741824", "requestedServiceObjectiveName": "Basic" } }, { "type": "Microsoft.Sql/servers/databases/securityAlertPolicies", "apiVersion": "2021-02-01-preview", "name": "sqlServer1/sqlDatabase1/securityPolicy1", "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "emailAccountAdmins": true, "emailAddresses": [], "retentionDays": 4, "state": "Enabled" } } ] } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` </details> <details><summary>Positive test num. 6 - json file</summary> ```json hl_lines="50" { "properties": { "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "functions": [], "variables": {}, "resources": [ { "name": "sqlServer1", "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlServer1" }, "properties": { "administratorLogin": "adminUsername", "administratorLoginPassword": "adminPassword" }, "resources": [ { "name": "sqlServer1/sqlDatabase1", "type": "Microsoft.Sql/servers/databases", "apiVersion": "2014-04-01", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlDatabase1" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "collation": "SQLLatin1GeneralCP1CI_AS", "edition": "Basic", "maxSizeBytes": "1073741824", "requestedServiceObjectiveName": "Basic" } }, { "type": "Microsoft.Sql/servers/databases/securityAlertPolicies", "apiVersion": "2021-02-01-preview", "name": "sqlServer1/sqlDatabase1/securityPolicy1", "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "emailAccountAdmins": true, "emailAddresses": [ "", "" ], "retentionDays": 4, "state": "Enabled" } } ] } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ``` </details> ```json title="Negative test num. 1 - json file" { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "functions": [], "variables": {}, "resources": [ { "name": "sqlServer1", "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlServer1" }, "properties": { "administratorLogin": "adminUsername", "administratorLoginPassword": "adminPassword" }, "resources": [ { "name": "sqlServer1/sqlDatabase1", "type": "Microsoft.Sql/servers/databases", "apiVersion": "2014-04-01", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlDatabase1" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "collation": "SQLLatin1GeneralCP1CI_AS", "edition": "Basic", "maxSizeBytes": "1073741824", "requestedServiceObjectiveName": "Basic" } }, { "type": "Microsoft.Sql/servers/databases/securityAlertPolicies", "apiVersion": "2021-02-01-preview", "name": "sqlServer1/sqlDatabase1/securityPolicy1", "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "emailAccountAdmins": true, "emailAddresses": [ "sample@email.com" ], "retentionDays": 4, "state": "Enabled" } } ] } ], "outputs": {} } ``` ```json title="Negative test num. 2 - json file" { "properties": { "template": { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": {}, "functions": [], "variables": {}, "resources": [ { "name": "sqlServer1", "type": "Microsoft.Sql/servers", "apiVersion": "2021-02-01-preview", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlServer1" }, "properties": { "administratorLogin": "adminUsername", "administratorLoginPassword": "adminPassword" }, "resources": [ { "name": "sqlServer1/sqlDatabase1", "type": "Microsoft.Sql/servers/databases", "apiVersion": "2014-04-01", "location": "[resourceGroup().location]", "tags": { "displayName": "sqlDatabase1" }, "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "collation": "SQLLatin1GeneralCP1CI_AS", "edition": "Basic", "maxSizeBytes": "1073741824", "requestedServiceObjectiveName": "Basic" } }, { "type": "Microsoft.Sql/servers/databases/securityAlertPolicies", "apiVersion": "2021-02-01-preview", "name": "sqlServer1/sqlDatabase1/securityPolicy1", "dependsOn": [ "[resourceId('Microsoft.Sql/servers', 'sqlServer1')]" ], "properties": { "emailAccountAdmins": true, "emailAddresses": [ "sample@email.com" ], "retentionDays": 4, "state": "Enabled" } } ] } ], "outputs": {} }, "parameters": {} }, "kind": "template", "type": "Microsoft.Blueprint/blueprints/artifacts", "name": "myTemplate" } ```