i need some help with postgresql flexible server and restoring a backup

Micheal Mueller 0 Reputation points
2025-12-05T19:27:06.1166667+00:00

we just did this in development RG and all was well, went to restore the same day backup in staging and it is failing to deploy the database in azure, then when i go to the RG i expected the db to be recreated in i see it but i am unable to load it or delete the resource as it says it cant be found....

any help would be great were kind of dead in the water till this is resolved.

Ran az deployment group list --resource-group RosieVision-Staging --query "[?properties.provisioningState=='Failed'].{deployment:name, timestamp:properties.timestamp, server:properties.error.details[0].target}" to capture every failed PostgreSQL flexible-server deployment. Azure reported the following targets, each left in a failed provisioning state:

staging-db-12-3-25 — failure recorded 2025‑12‑05T21:57:48Z (RestorePostgreSQLFlexibleServer_19c038…)

staging-12-2-25 — 2025‑12‑05T20:41:42Z (RestorePostgreSQLFlexibleServer_e21ece…)

staging-db — 2025‑12‑05T20:32:28Z (RestorePostgreSQLFlexibleServer_7daafa…)

staging-stage-12-2-25 — 2025‑12‑05T20:26:42Z (RestorePostgreSQLFlexibleServer_2e23f5…)

staging-stage-12-1-25 — 2025‑12‑05T19:12:59Z (RestorePostgreSQLFlexibleServer_ca876a…)

staging-stage — compute/storage update failed 2025‑12‑05T18:49:19Z (Microsoft.PostgreSQLFlexibleServer.UpdateComputeAndStoragePostgr)

stage-12-2-25 — 2025‑12‑05T18:36:59Z (RestorePostgreSQLFlexibleServer_903f0d…)

staging-stage-12-2-25 — two failed restore attempts at 2025‑12‑05T18:34:33Z and 2025‑12‑05T18:10:59Z

db-stage-12-2-25 — 2025‑12‑05T18:07:20Z (RestorePostgreSQLFlexibleServer_cade40…)

Each failure surfaced the same ResourceDeploymentFailure message (“resource write operation … reached terminal provisioning state ‘Failed’”). No PostgreSQL flexible server currently shows an active user-visible state of Failed (az postgres flexible-server list … returns only rv-chat-stage and rosievisiondb-staging-stage, both Ready), so these names only exist as failed deployments. Next step, if needed, is to inspect deployment operations for root-cause detail: az deployment operation group list --resource-group RosieVision-Staging --name <deploymentName>

thanks,
Micheal

Azure Database for PostgreSQL
{count} votes

2 answers

Sort by: Most helpful
  1. Pilladi Padma Sai Manisha 590 Reputation points Microsoft External Staff Moderator
    2025-12-05T19:40:39.0866667+00:00

    Hi Micheal Mueller,
    Thank you for reaching out to Microsoft QA!
    it sounds like you're running into some trouble with restoring a PostgreSQL flexible server backup in your staging environment. Here are a few steps you can take to troubleshoot this issue:

    First, check the deployment status in your staging RG using Azure CLI:

    text
    az deployment group list --resource-group <staging-rg-name> --query "[?properties.provisioningState=='Failed']"
    

    This lists failed deployments. For the relevant one, inspect details:

    text
    az deployment group show --name <deployment-name> -g <staging-rg-name> --query "properties"
    

    If it confirms a failed PostgreSQL server creation, force cleanup with:

    text
    az postgres flexible-server delete --resource-group <staging-rg-name> --name <server-name> --yes
    

    If the resource remains "not found," list all potential matches:

    text
    az resource list --resource-group <staging-rg-name> --resource-type "Microsoft.DBforPostgreSQL/flexibleServers" --output table
    

    Delete any orphans directly. Wait 5-10 minutes post-cleanup before retrying the restore, as Azure needs time to propagate changes.​

    Restore Retry Best Practices:

    Verify your source backup is within the retention period (7-35 days default) and the server state is "Ready" via portal or CLI (az postgres flexible-server show). Match compute/storage configs exactly between dev/staging, and avoid cross-AZ/region restores if not supported. Use "Fast Restore" from a recent full snapshot for quicker success, or CLI for precision:

    text
    az postgres flexible-server create --resource-group <staging-rg> --name <new-server> --location <region> --source-server <source-server> --restore-time "<timestamp>"
    

    Monitor via Activity Log (filter by "Microsoft.DBforPostgreSQL/flexibleServers" operations).​

    For further assistance, I suggest trying these things first, and if the problems persist, could you provide more details on the following?

    What exact steps did you follow for the restoration?

    Are there any error messages or codes that you can share?

    What type of network configuration is your server using (public or private)?

    Have you checked if the backup was correctly made and is indeed available for restoration?

    Reference:
    https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/how-to-restore-full-backup?tabs=portal-restore-full-backup
    if it doesn't work try doing in different region(ex: USwest3).

    Hope this helps!Feel free to reach out if you have any more questions!
    Following up to see if the below answer was helpful. If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

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.