Gallery › SQL › Azure Landing Zones Library
MySQL database servers enforce SSL connections.
Converted Policy Audit Deny Disabled Mode Indexed Version 1.1.0
Azure Database for MySQL supports connecting your Azure Database for MySQL server to client applications using Secure Sockets Layer (SSL). Enforcing SSL connections between your database server and your client applications helps protect against 'man in the middle' attacks by encrypting the data stream between the server and your application. This configuration enforces that SSL is always enabled for accessing your database server.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"name": "Deny-MySql-http",
"properties": {
"description": "Azure Database for MySQL supports connecting your Azure Database for MySQL server to client applications using Secure Sockets Layer (SSL). Enforcing SSL connections between your database server and your client applications helps protect against 'man in the middle' attacks by encrypting the data stream between the server and your application. This configuration enforces that SSL is always enabled for accessing your database server.",
"displayName": "MySQL database servers enforce SSL connections.",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "SQL",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.1.0"
},
"mode": "Indexed",
"parameters": {
"effect": {
"allowedValues": [
"Audit",
"Disabled",
"Deny"
],
"defaultValue": "Deny",
"metadata": {
"description": "Enable or disable the execution of the policy",
"displayName": "Effect"
},
"type": "String"
},
"minimalTlsVersion": {
"allowedValues": [
"TLS1_2",
"TLS1_0",
"TLS1_1",
"TLSEnforcementDisabled"
],
"defaultValue": "TLS1_2",
"metadata": {
"description": "Select version minimum TLS version Azure Database for MySQL server to enforce",
"displayName": "Select version minimum TLS for MySQL server"
},
"type": "String"
}
},
"policyRule": {
"if": {
"allOf": [
{
"equals": "Microsoft.DBforMySQL/servers",
"field": "type"
},
{
"anyOf": [
{
"exists": "false",
"field": "Microsoft.DBforMySQL/servers/sslEnforcement"
},
{
"field": "Microsoft.DBforMySQL/servers/sslEnforcement",
"notEquals": "Enabled"
},
{
"field": "Microsoft.DBforMySQL/servers/minimalTlsVersion",
"less": "[parameters('minimalTlsVersion')]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}# Converted from Deny-MySql-http.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-MySql-http' {
Properties @{
DisplayName = 'MySQL database servers enforce SSL connections.'
Description = 'Azure Database for MySQL supports connecting your Azure Database for MySQL server to client applications using Secure Sockets Layer (SSL). Enforcing SSL connections between your database server and your client applications helps protect against ''man in the middle'' attacks by encrypting the data stream between the server and your application. This configuration enforces that SSL is always enabled for accessing your database server.'
Category = 'SQL'
Version = '1.1.0'
Mode = 'Indexed'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled', 'Deny')
Default = 'Deny'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Parameter MinimalTlsVersion @{
AllowedValues = @('TLS1_2', 'TLS1_0', 'TLS1_1', 'TLSEnforcementDisabled')
Default = 'TLS1_2'
DisplayName = 'Select version minimum TLS for MySQL server'
Description = 'Select version minimum TLS version Azure Database for MySQL server to enforce'
}
Resource 'Microsoft.DBforMySQL/servers' {
Require 'sslEnforcement exists' {
Field sslEnforcement | Must -Exist
}
Require 'sslEnforcement is Enabled' {
Field sslEnforcement | Must -Be 'Enabled'
}
Require 'minimalTlsVersion is at least the MinimalTlsVersion parameter' {
Field minimalTlsVersion | Must -BeGreaterOrEqual (Param MinimalTlsVersion) -IfPresent
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-MySql-http.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw