Tutorial: Back up Azure Database for PostgreSQL - Flexible Server using Azure portal

This tutorial describes how to back up Azure Database for PostgreSQL - Flexible Server using the Azure portal.

Prerequisites

Before you back up Azure Database for PostgreSQL - Flexible Server, ensure the following prerequisites are met:

Configure backup for the database

To configure backup for Azure PostgreSQL – Flexible Server using Azure Backup, you can use one of the following methods:

  • Azure PostgreSQL – Flexible Server: Database manage pane
  • Backup vault
  • Azure Business Continuity Center

To configure backup on the Azure Database for PostgreSQL - Flexible Server via Azure Business Continuity Center, follow these steps:

  1. Go to Business Continuity Center, and then select Overview > + Configure protection.

    Screenshot shows how to initiate the database protection.

    Alternatively, for configuring backup from the Backup vault pane, go to the Backup vault > Overview, and then select + Backup.

    To configure backup from the Database manage pane, go to the PostgreSQL - flexible server pane, and then select Settings > LTR (Vaulted Backups).

  2. On the Configure protection pane, select Resource managed by as Azure, Datasource type as Azure Database for PostgreSQL flexible servers, and Solution as Azure Backup, and then select Continue.

    Screenshot shows the datasource and solution selection.

  3. On the Configure Backup pane, on the Basics tab, check if Datasource type appears as Azure Database for PostgreSQL flexible servers, click Select vault under Vault and choose an existing Backup vault from the dropdown list, and then select Next.

    If you don't have a Backup vault, create a new one.

    Screenshot shows the Backup vault selection.

  4. On the Backup policy tab, select a Backup policy that defines the backup schedule and the retention duration, and then select Next.

    If you don't have a Backup policy, create one on the go.

    Screenshot shows the Backup policy selection.

  5. On the Datasources tab, choose the datasource name.

  6. On the Select resources to backup pane, select the Azure PostgreSQL – Flexible Servers to back up, and then click Select.

    Note

    Ensure that you choose the Azure PostgreSQL – flexible Servers in the same region as that of the vault.

    Screenshot shows the database selection for backup.

    Once you're on the Datasources tab, the Azure Backup service validates if it has all the necessary access permissions to connect to the server. If one or more access permissions are missing, one of the following error messages appears – User cannot assign roles or Role assignment not done.

    • User cannot assign roles: This message appears when you (the backup admin) don’t have the write access on the PostgreSQL - flexible Server as listed under View details. To assign the necessary permissions on the required resources, select Download role assignment template to fetch the ARM template, and run the template as a PostgreSQL database administrator. Once the template is run successfully, select Revalidate.

      Screenshot shows the role assignment using a template.

    • Role assignment not done: This message appears when you (the backup admin) have the write access on the PostgreSQL – flexible Server to assign missing permissions as listed under View details. To grant permissions on the PostgreSQL - flexible Server inline, select Assign missing roles.

      Screenshot shows the role assignment using the Azure portal.

      Once the process starts, the missing access permissions on the PostgreSQL – flexible servers are granted to the backup vault. You can define the scope at which the access permissions must be granted. When the action is complete, revalidation starts.

  7. Once the role assignment validation shows Success, select Next to proceed to last step of submitting the operation.

    Screenshot shows the role assignment validation is successful.

  8. On the Review + configure tab, select Configure backup.

Run an on-demand backup

To trigger an on-demand backup (that's not in the schedule specified in the policy) for the database, follow these steps:

  1. Go to Business Continuity Center > Protection inventory > Protected items, and then select the Datasource type as Azure Database for PostgreSQL flexible servers to view the protected items.

    screenshot shows the selection of datasource type.

  2. Select the protected item to run an on-demand backup.

  3. On the Protected items pane, select more icon under the Associated items section, and then select Backup now.

    screenshot shows how to run an on-demand backup.

  4. On the Backup Now pane, validate Retention rules as per the associated Backup policy, and then select Backup now.

    screenshot shows how to start the Backup now operation.

Track a backup job

Azure Backup service creates a job for scheduled backups or if you trigger on-demand backup operation for tracking.

To view the backup job status, follow these steps:

  1. Go to Business Continuity Center > Monitoring + Reporting > Jobs.

    The Jobs pane appears that shows the operation and status for the past 24 hours.

    screenshot shows how to view the jobs.

  2. Review the list of backup and restore jobs and their status. To view the job details, select a job from the list.

    screenshot shows how to view the job details.

Next steps

Restore Azure Database for PostgreSQL - Flexible Server using Azure portal.