Gallery › Security Center › Azure built-in policies
Configure Advanced Threat Protection to be enabled on Azure database for MySQL flexible servers
Converted Policy DeployIfNotExists Disabled Mode Indexed Version 1.0.0
Enable Advanced Threat Protection on your Azure database for MySQL flexible servers to detect anomalous activities indicating unusual and potentially harmful attempts to access or exploit databases.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeployAtpOnMySqlFlexibleServers_DINE.json · 83 lines
{
"properties": {
"displayName": "Configure Advanced Threat Protection to be enabled on Azure database for MySQL flexible servers",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Enable Advanced Threat Protection on your Azure database for MySQL flexible servers to detect anomalous activities indicating unusual and potentially harmful attempts to access or exploit databases.",
"metadata": {
"version": "1.0.0",
"category": "Security Center"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "DeployIfNotExists",
"allowedValues": [
"DeployIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.DBforMySQL/flexibleservers"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.DBforMySQL/flexibleservers/advancedThreatProtectionSettings",
"name": "Default",
"evaluationDelay": "AfterProvisioningSuccess",
"existenceCondition": {
"field": "Microsoft.DBforMySQL/flexibleServers/advancedThreatProtectionSettings/state",
"equals": "Enabled"
},
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
],
"deployment": {
"properties": {
"mode": "incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"serverName": {
"type": "string"
}
},
"variables": {},
"resources": [
{
"name": "[concat(parameters('serverName'), '/Default')]",
"type": "Microsoft.DBforMySQL/flexibleservers/advancedThreatProtectionSettings",
"apiVersion": "2023-12-01-preview",
"properties": {
"state": "Enabled"
}
}
]
},
"parameters": {
"serverName": {
"value": "[field('name')]"
}
}
}
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/3d5ed4c2-5e50-4c76-932b-8982691b68ae",
"name": "3d5ed4c2-5e50-4c76-932b-8982691b68ae"
}Bylaw3d5ed4c2-5e50-4c76-932b-8982691b68ae.bylaw.ps1 · 31 lines
# Converted from DeployAtpOnMySqlFlexibleServers_DINE.json by ConvertTo-Bylaw.
Policy '3d5ed4c2-5e50-4c76-932b-8982691b68ae' {
Properties @{
DisplayName = 'Configure Advanced Threat Protection to be enabled on Azure database for MySQL flexible servers'
Description = 'Enable Advanced Threat Protection on your Azure database for MySQL flexible servers to detect anomalous activities indicating unusual and potentially harmful attempts to access or exploit databases.'
Version = '1.0.0'
Category = 'Security Center'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('DeployIfNotExists', 'Disabled')
Default = 'DeployIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBforMySQL/flexibleservers'
DeployIfNotExists 'Microsoft.DBforMySQL/flexibleservers/advancedThreatProtectionSettings' -Role 'Contributor' -Name 'Default' -EvaluationDelay AfterProvisioningSuccess -Effect (Param Effect) {
Require 'state is Enabled' {
Field state | Must -Be 'Enabled'
}
Deployment -TemplateFile './templates/3d5ed4c2-5e50-4c76-932b-8982691b68ae.json' -Parameters ([ordered]@{
serverName = (Arm '[field(''name'')]')
})
}
}Its deployment templates are written beside it:
templates/3d5ed4c2-5e50-4c76-932b-8982691b68ae.json
Source: built-in-policies/policyDefinitions/Security Center/DeployAtpOnMySqlFlexibleServers_DINE.json in Azure/azure-policy, under the MIT licence.
Bylaw