Gallery › SQL › Azure built-in policies
Azure Defender for SQL should be enabled for unprotected Azure SQL servers
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 2.0.1
Audit SQL servers without Advanced Data Security
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONSqlServer_AdvancedDataSecurity_Audit.json · 57 lines
{
"properties": {
"displayName": "Azure Defender for SQL should be enabled for unprotected Azure SQL servers",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Audit SQL servers without Advanced Data Security",
"metadata": {
"version": "2.0.1",
"category": "SQL"
},
"version": "2.0.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Sql/servers"
},
{
"field": "kind",
"notContains": "analytics"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.Sql/servers/securityAlertPolicies",
"name": "Default",
"existenceCondition": {
"field": "Microsoft.Sql/servers/securityAlertPolicies/state",
"equals": "Enabled"
}
}
}
},
"versions": [
"2.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/abfb4388-5bf4-4ad7-ba82-2cd2f41ceae9",
"name": "abfb4388-5bf4-4ad7-ba82-2cd2f41ceae9"
}Bylawabfb4388-5bf4-4ad7-ba82-2cd2f41ceae9.bylaw.ps1 · 33 lines
# Converted from SqlServer_AdvancedDataSecurity_Audit.json by ConvertTo-Bylaw.
Policy 'abfb4388-5bf4-4ad7-ba82-2cd2f41ceae9' {
Properties @{
DisplayName = 'Azure Defender for SQL should be enabled for unprotected Azure SQL servers'
Description = 'Audit SQL servers without Advanced Data Security'
Version = '2.0.1'
Category = 'SQL'
PolicyVersion = '2.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Sql/servers' {
Require 'kind contains analytics' {
Field kind | Must -ContainText 'analytics'
}
}
AuditIfNotExists 'Microsoft.Sql/servers/securityAlertPolicies' -Name 'Default' -Effect (Param Effect) {
Require 'state is Enabled' {
Field state | Must -Be 'Enabled'
}
}
}Source: built-in-policies/policyDefinitions/SQL/SqlServer_AdvancedDataSecurity_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw