Upgrade/Migrate to a new PostgreSQL server

Upgrade Azure PostgreSQL from single server to flex server:

Backup the database

Prerequisite to backup a database/server - Create an empty sql/text file.

Backup the database using pgadmin tool -

  • Right-Click on the database, choose Backup.

  • On the pop-up window browse and choose the sql/text file for the Filename.

  • Configure other settings as required(Default options were left in our case)

  • Click “Backup”

 

The progress of the backup should appear on a window and a message stating the status of the process would appear on it. (If failed, view error details by clicking on “More details…”)

Deploy Flex server resource on Azure portal

  • Add/update bicep script/yaml to deploy PostgreSQL flex server, firewall rule and database(s)

  • Configure the variables of the “Azure Resources Deployment 2 (Safsecsur)” pipeline and run it pointing to the branch where you have the latest bicep script and yaml changes.

  • After the pipeline run successfully, the resources should be created on the Azure portal.

Azure portal changes

  • Add/update connectionstring as a secret value to the keyvault

  • Add appservice outbound ipaddresses as a firewallrule to the PostgreSQL server networking section to whitelist them.

Restore the databases in the new flex server

  • Right-Click on the new database, choose Restore.

  • On the pop-up window browse and choose the backup sql/text file for the Filename.

  • Configure other settings as required(Default options were left in our case)

  • Click “Restore”

The progress of the restore should appear on a window and a message stating the status of the process would appear on it. (If failed, view error details by clicking on “More details…”)

Post deployment steps

Run the project pipeline to get the latest docker image with the new keyvault secret value.

Test the WebAPI/WebApp

 

Resources