For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/terraform-azure-postgresql-log-connections-not-set.md.
A documentation index is available at /llms.txt.
The PostgreSQL server parameter log_connections should be set to ON to ensure that all connection attempts, whether successful or not, are logged. Without this setting, unauthorized or suspicious connection attempts can go undetected, making it difficult to identify potential security incidents or troubleshoot access issues. For a secure configuration in Terraform, set the value attribute to "on", as shown below:
resource "azurerm_postgresql_configuration" "secure" {
name = "log_connections"
resource_group_name = data.azurerm_resource_group.example.name
server_name = azurerm_postgresql_server.example.name
value = "on"
}