Gallery › SQL › Azure built-in policies
Enforce SSL connection should be enabled for PostgreSQL database servers
Converted Policy Audit Disabled Mode Indexed Version 1.0.1
Azure Database for PostgreSQL supports connecting your Azure Database for PostgreSQL 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.
{
"properties": {
"displayName": "Enforce SSL connection should be enabled for PostgreSQL database servers",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Azure Database for PostgreSQL supports connecting your Azure Database for PostgreSQL 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.",
"metadata": {
"version": "1.0.1",
"category": "SQL"
},
"version": "1.0.1",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.DBforPostgreSQL/servers"
},
{
"field": "Microsoft.DBforPostgreSQL/servers/sslEnforcement",
"exists": "true"
},
{
"field": "Microsoft.DBforPostgreSQL/servers/sslEnforcement",
"notEquals": "Enabled"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.1"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/d158790f-bfb0-486c-8631-2dc6b4e8e6af",
"name": "d158790f-bfb0-486c-8631-2dc6b4e8e6af"
}# Converted from PostgreSQL_EnableSSL_Audit.json by ConvertTo-Bylaw.
Policy 'd158790f-bfb0-486c-8631-2dc6b4e8e6af' {
Properties @{
DisplayName = 'Enforce SSL connection should be enabled for PostgreSQL database servers'
Description = 'Azure Database for PostgreSQL supports connecting your Azure Database for PostgreSQL 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.'
Version = '1.0.1'
Category = 'SQL'
PolicyVersion = '1.0.1'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBforPostgreSQL/servers' {
When {
Field sslEnforcement | Must -Exist
}
Require 'sslEnforcement is Enabled' {
Field sslEnforcement | Must -Be 'Enabled'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/SQL/PostgreSQL_EnableSSL_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw