Skip to content

Add PostgreSQL Flexible Server ATP policy to Enforce-Guardrails-PostgreSQL - #2181

Open
kumarpk3456 (kumarpk3456) wants to merge 3 commits into
mainfrom
bugfix-4232-postgresql-flexible-server
Open

Add PostgreSQL Flexible Server ATP policy to Enforce-Guardrails-PostgreSQL#2181
kumarpk3456 (kumarpk3456) wants to merge 3 commits into
mainfrom
bugfix-4232-postgresql-flexible-server

Conversation

@kumarpk3456

@kumarpk3456 kumarpk3456 (kumarpk3456) commented Aug 5, 2026

Copy link
Copy Markdown

Fixes 4232

Overview

This Pull Request updates the Enforce-Guardrails-PostgreSQL initiative to include support for Azure Database for PostgreSQL Flexible Server Advanced Threat Protection.

The initiative previously referenced only the built-in policy db048e65-913c-49f9-bb5f-1084184671d3, which targets the legacy Microsoft.DBforPostgreSQL/servers resource type. As a result, Microsoft.DBforPostgreSQL/flexibleServers resources were not evaluated by this guardrail.

This PR adds/fixes

  1. Adds the built-in policy 2a6ae02f-7590-40d7-88ba-b18e205a32fd (Configure Advanced Threat Protection to be enabled on Azure database for PostgreSQL flexible servers) to the Enforce-Guardrails-PostgreSQL initiative.
  2. Retains the existing built-in policy db048e65-913c-49f9-bb5f-1084184671d3 for PostgreSQL Single Server deployments.
  3. Extends PostgreSQL guardrail coverage to include both Microsoft.DBforPostgreSQL/servers and Microsoft.DBforPostgreSQL/flexibleServers resource types.

Breaking Changes

  1. None.
  2. Existing PostgreSQL Single Server coverage remains unchanged and backward compatible.

Testing Evidence

  1. Old initiative, it only contains policy id for Deploy Advanced Threat Protection for Azure Database for PostgreSQL server
    (db048e65-913c-49f9-bb5f-1084184671d3), no flexible server policy present
Screenshot 2026-08-06 200420 image
  1. New initiative i add flexible server policy id in the repo that is microsoft built in policy
image image
  1. Validated JSON syntax using PowerShell:
    Get-Content .\src\resources\Microsoft.Authorization\policySetDefinitions\Enforce-Guardrails-PostgreSQL.json | ConvertFrom-Json
Screenshot 2026-08-05 202000
  1. Verified initiative contains both policy references:
    db048e65-913c-49f9-bb5f-1084184671d3 (PostgreSQL Single Server ATP policy)
    2a6ae02f-7590-40d7-88ba-b18e205a32fd (PostgreSQL Flexible Server ATP policy)
Screenshot 2026-08-05 202159
  1. Locally tested the issue
    Step 1:- PostgreSQL Flexible Server Deployment
    Caption: Created a test Azure Database for PostgreSQL Flexible Server resource for policy validation.
    What it shows:
    PostgreSQL Flexible Server successfully deployed.
    Resource Name: pgflex4232test
    Used as the target resource to validate initiative coverage.
screenshot 1 **Step 2**- Policy Referenced by Initiative Caption: Verified that the Enforce recommended guardrails for PostgreSQL initiative references the built-in Advanced Threat Protection policy. What it shows: Built-in Policy ID: db048e65-913c-49f9-bb5f-1084184671d3 Policy name: Configure Advanced Threat Protection to be enabled on Azure database for PostgreSQL servers. screenshot 2 **Step 3**- Policy Scope Validation Caption: Confirmed that the referenced built-in policy targets only the legacy PostgreSQL Single Server resource type. Screenshot 3 **Step 4**- Initiative Assignment Caption: Assigned the Enforce recommended guardrails for PostgreSQL initiative to the test resource group containing the Flexible Server. What it shows: Initiative successfully assigned. Scope: rg-postgres4232-test Effect: DeployIfNotExists screenshot 4 **Step 5**- Compliance Evaluation Caption: Executed Azure Policy compliance evaluation against the assigned PostgreSQL guardrails initiative. What it shows: Initiative compliance state. ATP policy evaluation results. Azure Policy successfully processed the assignment. Screenshot 5
  1. Validation completed by deploying a PostgreSQL Flexible Server, reviewing the initiative's referenced policy definitions, confirming the built-in ATP policy only targets Microsoft.DBforPostgreSQL/servers, assigning the initiative to a test scope, and verifying policy evaluation behavior, which confirms the root cause and validates the Flexible Server coverage fix for Issue #4232.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Postgress policy Enforce-GR-PostgreSQL0 does not support the Azure Database for PostgreSQL flexible servers

2 participants