Review the minimum TLS version for Azure PostgreSQL

Protect PostgreSQL connections with supported TLS versions and server certificate validation.

Description

Azure PostgreSQL Flexible Server supports TLS 1.2 and 1.3. Its default minimum is TLS 1.2.

Potential impact

Raising the minimum can disconnect clients that support only an older protocol.

Remediation

Keep require_secure_transport on. Set ssl_min_protocol_version to TLSv1.2, or choose TLSv1.3 once all required clients support it. Test application connections with server certificate verification enabled.

Examples

The first excerpt uses TLS 1.1 on retired Single Server. The second sets two parameters on an existing Flexible Server. Plan data migration and client cutover separately.

Before

hcl
resource "azurerm_postgresql_server" "example" {
  name                = "example-postgresql"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  sku_name            = "GP_Gen5_4"
  version             = "11"

  ssl_enforcement_enabled          = true
  ssl_minimal_tls_version_enforced = "TLS1_1"
}

After

hcl
resource "azurerm_postgresql_flexible_server_configuration" "require_tls" {
  name      = "require_secure_transport"
  server_id = azurerm_postgresql_flexible_server.example.id
  value     = "on"
}

resource "azurerm_postgresql_flexible_server_configuration" "example" {
  name      = "ssl_min_protocol_version"
  server_id = azurerm_postgresql_flexible_server.example.id
  value     = "TLSv1.2"
}

References