PostgreSQL flexible server has geo-redundant backup enabled
Azure PostgreSQL Flexible Server is evaluated for geo-redundant backup. Geo-redundant backup stores backup copies in a paired Azure region, enabling restore and cross-region disaster recovery.
Risk
Without geo-redundant backup, a regional disaster can cause permanent data loss. Locally redundant backups only protect against storage hardware failures within the same region and cannot be restored if the primary region becomes unavailable.
Run this check with Prowler
Run in Prowler Cloudprowler azure --checks postgresql_flexible_server_geo_redundant_backup_enabledRecommendation
Enable geo-redundant backup on PostgreSQL Flexible Servers so backups are replicated to the paired Azure region and can be restored during a regional outage. Because this is set at server creation, plan a migration for existing servers, and pair it with an appropriate backup retention period and periodic restore testing.
Remediation
CLI
az postgres flexible-server create --name <server_name> --resource-group <resource_group_name> --location <region> --geo-redundant-backup EnabledTerraform
# Terraform: PostgreSQL Flexible Server with geo-redundant backup (set at creation)
resource "azurerm_postgresql_flexible_server" "<example_resource_name>" {
name = "<example_resource_name>"
resource_group_name = "<example_resource_name>"
location = "<region>"
geo_redundant_backup_enabled = true # CRITICAL: stores backups in the paired region
}NativeIaC
// Bicep: PostgreSQL Flexible Server with geo-redundant backup (set at creation)
resource postgresql 'Microsoft.DBforPostgreSQL/flexibleServers@2023-06-01-preview' = {
name: '<example_resource_name>'
location: '<region>'
properties: {
backup: {
geoRedundantBackup: 'Enabled' // CRITICAL: stores backups in the paired region
}
}
}Other
Check Code
from prowler.lib.check.models import Check, Check_Report_Azure
from prowler.providers.azure.services.postgresql.postgresql_client import (
postgresql_client,
)
class postgresql_flexible_server_geo_redundant_backup_enabled(Check):
"""
Ensure Azure PostgreSQL Flexible Servers have geo-redundant backup enabled.
This check evaluates whether each Azure PostgreSQL Flexible Server stores backups in a paired Azure region, enabling cross-region disaster recovery.
- PASS: The server has geo-redundant backup enabled (geo_redundant_backup is "Enabled").
- FAIL: The server does not have geo-redundant backup enabled.
"""
def execute(self) -> Check_Report_Azure:
findings = []
for (
subscription,
flexible_servers,
) in postgresql_client.flexible_servers.items():
subscription_name = postgresql_client.subscriptions.get(
subscription, subscription
)
for server in flexible_servers:
report = Check_Report_Azure(metadata=self.metadata(), resource=server)
report.subscription = subscription
if server.geo_redundant_backup == "Enabled":
report.status = "PASS"
report.status_extended = f"Flexible Postgresql server {server.name} from subscription {subscription_name} ({subscription}) has geo-redundant backup enabled."
else:
report.status = "FAIL"
report.status_extended = f"Flexible Postgresql server {server.name} from subscription {subscription_name} ({subscription}) does not have geo-redundant backup enabled."
findings.append(report)
return findings