Gallery › PostgreSQL › Azure built-in policies
PostgreSQL flexible servers should be running TLS version 1.2 or newer
Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.1.0
This policy helps audit any PostgreSQL flexible servers in your environment which is running with TLS version less than 1.2.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONFlexibleServers_MinTLS_AINE.json · 53 lines
{
"properties": {
"displayName": "PostgreSQL flexible servers should be running TLS version 1.2 or newer",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "This policy helps audit any PostgreSQL flexible servers in your environment which is running with TLS version less than 1.2.",
"metadata": {
"version": "1.1.0",
"category": "PostgreSQL"
},
"version": "1.1.0",
"parameters": {
"effect": {
"type": "string",
"defaultValue": "AuditIfNotExists",
"allowedValues": [
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.DBforPostgreSQL/flexibleServers"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.DBforPostgreSQL/flexibleServers/configurations",
"name": "ssl_min_protocol_version",
"existenceCondition": {
"field": "Microsoft.DBforPostgreSQL/flexibleServers/configurations/value",
"in": [
"TLSV1.2",
"TLSV1.3"
]
}
}
}
},
"versions": [
"1.1.0",
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a43d5475-c569-45ce-a268-28fa79f4e87a",
"name": "a43d5475-c569-45ce-a268-28fa79f4e87a"
}Bylawa43d5475-c569-45ce-a268-28fa79f4e87a.bylaw.ps1 · 28 lines
# Converted from FlexibleServers_MinTLS_AINE.json by ConvertTo-Bylaw.
Policy 'a43d5475-c569-45ce-a268-28fa79f4e87a' {
Properties @{
DisplayName = 'PostgreSQL flexible servers should be running TLS version 1.2 or newer'
Description = 'This policy helps audit any PostgreSQL flexible servers in your environment which is running with TLS version less than 1.2.'
Version = '1.1.0'
Category = 'PostgreSQL'
PolicyVersion = '1.1.0'
Mode = 'Indexed'
}
Parameter Effect @{
Type = 'string'
AllowedValues = @('AuditIfNotExists', 'Disabled')
Default = 'AuditIfNotExists'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.DBforPostgreSQL/flexibleServers'
AuditIfNotExists 'Microsoft.DBforPostgreSQL/flexibleServers/configurations' -Name 'ssl_min_protocol_version' -Effect (Param Effect) {
Require 'value is one of 2 values' {
Field value | Must -BeIn @('TLSV1.2', 'TLSV1.3')
}
}
}Source: built-in-policies/policyDefinitions/PostgreSQL/FlexibleServers_MinTLS_AINE.json in Azure/azure-policy, under the MIT licence.
Bylaw