Review Azure PostgreSQL threat detection

Verify Defender protection for suspicious PostgreSQL activity and actual alert delivery.

Description

Microsoft Defender for open-source relational databases alerts on unusual access and suspicious queries on supported Azure PostgreSQL Flexible Servers.

Potential impact

Responders may miss suspicious activity if coverage or alert delivery is missing.

Remediation

Review the subscription-wide scope and cost. If the plan is already managed, update its existing configuration. Enable OpenSourceRelationalDatabases where required and confirm server coverage and alert delivery. Keep database permissions, network restrictions and logging in place.

Examples

The first excerpt shows a retired Single Server. Replace the example password with a managed secret. The second enables paid coverage for supported databases in the subscription. Server migration and alert recipients are configured separately.

Before

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

  administrator_login          = "psqladminun"
  administrator_login_password = "H@Sh1CoR3!"

  sku_name   = "GP_Gen5_4"
  version    = "9.6"
  storage_mb = 640000

  backup_retention_days        = 7
  geo_redundant_backup_enabled = true
  auto_grow_enabled            = true

  public_network_access_enabled    = false
  ssl_enforcement_enabled          = true
  ssl_minimal_tls_version_enforced = "TLS1_2"

  threat_detection_policy {
    enabled = false
  }
}

After

hcl
resource "azurerm_security_center_subscription_pricing" "example" {
  tier          = "Standard"
  resource_type = "OpenSourceRelationalDatabases"
}

References