Intermittent 502 Bad Gateway / ServerUnableToRetriveData - Postgres Flexible Server - Canada Central

Daan de Bruin 20 Reputation points
2026-01-20T09:11:59.9233333+00:00

We are encountering a persistent platform-level error specifically in the Canada Central region when managing PostgreSQL Flexible Server databases via the Azure Resource Manager API.

The Error:

Status: 502 Bad Gateway

Error Code: ServerUnableToRetriveData

Message: 'Server encountered an issue while trying to retrieve some data. Try again later.'

Context: This issue is isolated to our resources in Canada Central. Identical Terraform deployments in three other regions (US East, West Europe, etc.) are working perfectly. The error occurs during the 'Refresh' phase, suggesting the Resource Provider (Microsoft.DBforPostgreSQL) is having trouble retrieving metadata for specific instances in this region.

Has anyone else noticed regional API instability in Canada Central for Postgres, or is there a known issue with the resource provider metadata state?"

Azure Database for PostgreSQL
{count} votes

2 answers

Sort by: Most helpful
  1. Pilladi Padma Sai Manisha 3,380 Reputation points Microsoft External Staff Moderator
    2026-01-20T10:21:38.2733333+00:00

    Hi Daan de Bruin,
    Thank you for clarifying! You're absolutely right the 502 Bad Gateway / ServerUnableToRetriveData during config changes on existing PostgreSQL Flexible Server resources is a Microsoft.DBforPostgreSQL resource provider issue in Canada Central's control plane failing to retrieve metadata. This exact pattern has been reported there since Jan 20.Verify Platform Fault (30 seconds):Test this direct ARM GET call (replace your sub/rg/server):

    text
    az rest --method get --url "/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{server}/databases?api-version=2021-06-01"
    

    Same 502 confirms it's the RP, not your Terraform.

    Unblock Immediately:

    Skip Terraform refresh (safest/fastest):

    text
    terraform plan -refresh=false -out=tfplan
    terraform apply tfplan
    

    OR bypass ARM databases (data plane always works):

    text
    psql "host=yourserver.postgres.database.azure.com port=5432 dbname=postgres sslmode=require" -c "CREATE DATABASE yourdb;"
    

    Current status:

    No broad Canada Central PostgreSQL outages showing on Azure Status today (Jan 29), but this matches multiple customer reports of RP metadata timeouts in the region. Check your Service Health blade and Activity Log correlation IDs (x-ms-correlation-request-id) for tracking.

    While Waiting for RP Stability

    text
    # Pin older stable API version with AzAPI provider
    resource "azapi_resource" "db" {
      type      = "Microsoft.DBforPostgreSQL/flexibleServers/databases@2021-06-01"
      # ... your config
    }
    

    The terraform plan -refresh=false will keep you moving today. Test the ARM repro and share correlation IDs/timestamps here . Let me know the results!

    0 comments No comments

  2. Sina Salam 27,786 Reputation points Volunteer Moderator
    2026-01-20T11:44:27.7433333+00:00

    Hello Daan de Bruin,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are having intermittent 502 Bad Gateway / ServerUnableToRetriveData - Postgres Flexible Server - Canada Central.

    This isn’t a quota problem but a regional control‑plane fault in Canada Central: the ARM RP returns 502 with ServerUnableToRetriveData on metadata GET/refresh calls. That pattern matches RP/API instability, not provisioning limits, and has been seen for PostgreSQL Flexible Server databases during Terraform refresh. - Flexible Server Database Refresh fails with 502.

    First, check your tenant’s Azure Service Health and the public Azure Status page for Canada Central to rule in/out an RP incident. Then reproduce with a direct ARM GET of the databases list; if it still returns 502, the fault is platform‑side, not your code or quota. References: Service Health and Azure Status; comparable behavior during control‑plane incidents. Azure Service Health, Azure Status,, Azure AFD Outage

    Next, open a Microsoft Support case via your Azure portal for Azure Database for PostgreSQL, Flexible Server (control‑plane) and attach several correlation IDs + UTC timestamps. Create the ticket in the Azure portal and include IDs from Activity Log or response headers (x-ms-correlation-request-id, x-ms-request-id).

    To keep pipelines unblocked, avoid refresh‑time reads on the flaky subresource and temporarily run: terraform plan -refresh=false then apply the saved plan. Where you must manage databases via ARM, pin an older stable API for flexibleServers/databases using AzAPI until the RP is fixed. Docs: Terraform plan options and AzAPI resource/API‑version matrix.

    Alternatively, create databases at the data plane (CREATE DATABASE …) with retry logic and stop declaring them as ARM child resources for now. If time‑critical, deploy the same stack to a known‑good region (e.g., US East/West Europe) until Canada Central is healthy again. Guidance: Postgres transient‑error troubleshooting and the original regional observation.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.