Review Azure PostgreSQL encryption at rest

Distinguish default storage encryption from additional key requirements and use supported PostgreSQL settings.

Description

Azure PostgreSQL encrypts data and backups at rest by default. Setting infrastructure_encryption_enabled = false on the former Single Server leaves that default encryption in place.

Potential impact

AzureRM 3.117.1 warns that enabling this unsupported option can impair performance.

Remediation

Migrate data to a supported Flexible Server. If you must control the key, verify the supported customer-managed key configuration and its access and recovery procedures. Switching who manages a key is separate from adding a second encryption layer. Also verify backups, TLS and network access.

Examples

The AzureRM 5.6.0 Flexible Server excerpt disables public access. If the source still uses example-psqlserver, give the new server an available, globally unique name. Configure authentication, capacity and private connectivity, then verify the migrated data before switching clients.

Before

hcl
resource "azurerm_postgresql_server" "example" {
  name                = "example-psqlserver"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  public_network_access_enabled     = false
  ssl_enforcement_enabled           = true
  ssl_minimal_tls_version_enforced  = "TLS1_2"
  infrastructure_encryption_enabled = false
}

After

hcl
resource "azurerm_postgresql_flexible_server" "example" {
  name                = "example-psqlserver"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name

  public_network_access_enabled = false
}

References