You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/backup/backup-azure-database-postgresql-flex-support-matrix.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Azure Database for PostgreSQL- Flexible server support matrix
3
3
description: Provides a summary of support settings and limitations of Azure Database for PostgreSQL- Flexible server backup.
4
4
ms.topic: reference
5
-
ms.date: 04/11/2025
5
+
ms.date: 04/30/2025
6
6
ms.custom: references_regions, ignite-2024
7
7
ms.service: azure-backup
8
8
author: jyothisuri
@@ -41,6 +41,22 @@ Azure Database for PostgreSQL – Flexible Server backups include the following
41
41
- Vaulted backups support full backups only; incremental or differential backups aren't supported.
42
42
43
43
44
+
### Restore limitations
45
+
- The use of **create role** scripts for `azure_su`, `azure_pg_admin`, `replication`, `localadmin`, and `Entra Admin` causes the following errors during restoration on another flexible server, which you can safely ignore.
46
+
47
+
-`role "azure_pg_admin" already exists.`
48
+
-`role "azuresu" already exists.`
49
+
-`role "replication" already exists.`
50
+
-`ERROR: must be superuser to create superusers`
51
+
-`ERROR: Only roles with privileges of role "azuresu" may grant privileges as this role. permission denied granting privileges as role "azuresu"`
52
+
-`ERROR: permission denied granting privileges as role "azuresu" SQL state: 42501 Detail: Only roles with privileges of role "azuresu" may grant privileges.`
53
+
-`Ignore any errors related to pg_catalog, pg _aadauth extensions as it is owned by azure_su and localadmin does not have access to directly create this extension on flexible server, but these are automatically created on new flexible servers or when you enable Microsoft entra authentication.`
54
+
-`ERROR: Only roles with the ADMIN option on role "pg_use_reserved_connections" may grant this role. permission denied to grant role "pg_use_reserved_connections"`
55
+
-`ERROR: permission denied to grant role "pg_use_reserved_connections" SQL state: 42501 Detail: Only roles with the ADMIN option on role "pg_use_reserved_connections" may grant this role.`
56
+
57
+
- In PostgreSQL **community version 16**, the requirement for superuser privileges to set the Bypass Row -level security (RLS) attribute was removed. So, in versions 16 and higher, you can grant the Bypass RLS to azure_pg_admin allowing others to set the RLS. For versions lower than 16, the bypasses attribute is granted only to the server admin and no other nonsuperuser roles.
58
+
- If you're using Entra Admins after restoration, you might encounter the **Owner Change Issue** : As a workaround, use the **grant** option to provide ownership.
title: Restore Azure Database for PostgreSQL-Flexible server using Azure portal
3
-
description: Learn about how to restore Azure Database for PostgreSQL-Flexible backups.
2
+
title: Restore Azure PostgreSQL-Flexible server as Files using Azure portal
3
+
description: Learn about how to restore Azure PostgreSQL-Flexible server as Files.
4
4
ms.topic: how-to
5
-
ms.date: 03/18/2025
5
+
ms.date: 04/30/2025
6
6
ms.service: azure-backup
7
7
ms.custom:
8
8
- ignite-2024
9
9
author: jyothisuri
10
10
ms.author: jsuri
11
11
---
12
12
13
-
# Restore Azure Database for PostgreSQL - Flexible Server using Azure portal
13
+
# Restore Azure PostgreSQL-Flexible server as Files using Azure portal
14
14
15
-
This article describes how to restore an Azure PostgreSQL-Flexible Server backed up using Azure portal.
15
+
This article describes how to restore an Azure PostgreSQL-Flexible server as Files backed up using Azure portal.
16
16
17
17
## Prerequisites
18
18
@@ -26,7 +26,10 @@ Before you restore from Azure Database for PostgreSQL Flexible server backups, r
26
26
27
27
## Restore Azure PostgreSQL-Flexible database
28
28
29
-
Follow these steps:
29
+
>[!Note]
30
+
>The restore operation transfers all PostgreSQL – flexible server databases to a designated storage account container. After restoration, move the files to a new or existing PostgreSQL – Flexible server.
31
+
32
+
To restore Azure PostgreSQL-Flexible database, Follow these steps:
30
33
31
34
1. Go to **Backup vault** > **Backup Instances**. Select the PostgreSQL - Flexible server to be restored and select **Restore**.
32
35
@@ -49,41 +52,76 @@ Follow these steps:
49
52
1. Submit the Restore operation and track the triggered job under **Backup jobs**.
50
53
:::image type="content" source="./media/restore-azure-database-postgresql-flex/validate.png" alt-text="Screenshot showing the validate process page.":::
51
54
52
-
1. Once the job is finished, the backed-up data is restored into the storage account. Below are the set of files recovered in your storage account after the restore:
53
55
54
-
- The first file is a marker or timestamp file that gives the customer the time the backup was taken at. The file cannot be restored but if opened with a text editor should tell the customer the UTC time when the backup was taken.
55
-
56
-
- The Second file **_database_** is an individual database backup for database called tempdata2 taken using pg_dump. Each database has a separate file with format **– {backup_name}_database_{db_name}.sql**
57
-
58
-
- The Third File **_roles**. Has roles backed up using pg_dumpall
59
-
60
-
- The Fourth file **_schemas**. backed up using pg_dumpall
61
-
62
-
- The Fifth file **_tablespaces**. Has the tablespaces backed up using pg_dumpall
56
+
After the restore job is completed successfully, go to the storage account container to view the restored databases as files (`.sql` files) from your PostgreSQL – Flexible server. Azure Backup also generates the following backup files:
63
57
64
-
1. Post restoration completion to the target storage account, you can use pg_restore utility to restore the database and other files to a PostgreSQL Flexible server. Use the following command to connect to an existing postgresql flexible server and an existing database
58
+
-`Database.sql file` per database: Contains data and schema information for a particular database.
59
+
-`Roles.sql files` for entire instance: Contains all role information ((azure_su(superuser) azure_pg_admin, replication, local admin, Microsoft Entra admins and any other custom roles on the server)) that exists at server level.
60
+
-`Tablespace.sql file`: Tablespace file.
61
+
-`Schema.sql file`: Contains schema information for all the databases on the server.
>We recommend you not to run this script on the PostgreSQL - Flexible server because the schema is already part of the `database.sql` script.
67
65
68
-
*`--account-name`: Name of the Target Storage Account.
69
-
*`--container-name`: Name of the blob container.
70
-
*`--blob-name`: Name of the blob.
71
-
*`--account-key`: Storage Account Key.
72
-
*`-Fd`: The directory format.
73
-
*`-j`: The number of jobs.
74
-
*`-C`: Begin the output with a command to create the database itself and then reconnect to it.
66
+
:::image type="content" source="./media/restore-azure-database-postgresql-flex/database-files.png" alt-text="Screenshot shows the database schema per database." lightbox="./media/restore-azure-database-postgresql-flex/database-files.png":::
75
67
76
-
If you have more than one database to restore, re-run the earlier command for each database.
68
+
## Restore the backup files from storage container to a new or existing PostgreSQL – Flexible server
77
69
78
-
Also, by using multiple concurrent jobs `-j`, you can reduce the time it takes to restore a large database on a multi-vCore target server. The number of jobs can be equal to or less than the number of vCPUs that are allocated for the target server.
70
+
To restore the backup files from storage container to a new or existing PostgreSQL – Flexible server, follow these steps:
79
71
80
-
1. To restore the other three files (roles, schema and tablespaces), use the psql utility to restore them to a PostgreSQL Flexible server.
72
+
1. Ensure that all required [extensions are enabled](/azure/postgresql/extensions/how-to-allow-extensions?tabs=allow-extensions-portal) on the new target Flexible server.
73
+
1.[Match the server parameter](/azure/postgresql/flexible-server/how-to-server-parameters-list-all?tabs=portal-list) values from the source PostgreSQL database to the Azure Database for PostgreSQL by accessing the **Server parameters** section in the Azure portal and manually updating the values accordingly. Save the parameter changes, and then restart the Azure Database for PostgreSQL - Flexible server to apply the new configuration.
74
+
1. If **Microsoft Entra Authentication** is required on the new server, enable it and create the relevant Microsoft Entra admins.
>Before the database restoration, you must create a new, empty database. Ensure that your user account has the **`CREATEDB`** permission.
79
+
>
80
+
>To create the database, use the `CREATE DATABASE Database_name` command.
84
81
85
-
Re-run the above command for each file.
82
+
1. Restore the database using the `database.sql file` as the target admin user.
83
+
1.After the target database is created, restore the data in this database (from the dump file) from an Azure storage account by running the following command:
-`--account-name`: Name of the Target Storage Account.
90
+
-`--container-name`: Name of the blob container.
91
+
-`--blob-name`: Name of the blob.
92
+
-`--account-key`: Storage Account Key.
93
+
-`-Fd`: The directory format.
94
+
-`-j`: The number of jobs.
95
+
-`-C`: Begin the output with a command to create the database itself and then reconnect to it.
86
96
87
-
## Next steps
97
+
Alternatively, you can download the backup file and run the restore directly.
98
+
99
+
1. Restore only the required roles and privileges, and ignore the [common errors](backup-azure-database-postgresql-flex-support-matrix.md#restore-limitations). Skip this step if you're performing the restoration for compliance requirements and data retrieval, as a local admin.
100
+
101
+
## Restore roles and users for the restored databases
102
+
103
+
Vaulted backups are primarily restored for compliance needs such as, testing and audits. You can sign in as a local admin and restore using the `database.sql` file; no other roles are needed for data retrieval.
104
+
105
+
For other uses like accidental deletion protection or disaster recovery, ensure necessary roles are created as per your organization needs. Avoid duplications between `roles.sql` and `database.sql`.
106
+
107
+
-**Restore the same Flexible server**: Role restoration might not be necessary.
108
+
-**Restore to a different Flexible server**: Use the `roles.sql` file to recreate the required roles.
109
+
110
+
When you restore from `roles.sql`, some roles or attributes might not be valid for the new target server.
111
+
112
+
For environments with superuser access (on-premises or VMs), you can run all commands seamlessly.
113
+
114
+
### Key considerations for the Flexible server scenario
115
+
116
+
Here are the key considerations:
117
+
118
+
-**Remove Superuser-Only Attributes**: On Flexible server, there's no superuser privileges. So, remove attributes, such as `NOSUPERUSER` and `NOBYPASSRLS` from the roles dump.
119
+
-**Exclude Service-Specific Users**: Exclude users specific to Flexible Server services (` azure_su`, `azure_pg_admin`, `replication`, `localadmin`, `Entra Admin`). These specific service roles are automatically recreated when administrators are added to the new Flexible server.
120
+
121
+
Before you restore the database objects, ensure that you properly dump and clean up the roles. To perform this action, download the `roles.sql`script from your storage container and create all required logins.
122
+
-**Create Non-Entra Roles**: Use a local admin account to run the role creation scripts.
123
+
-**Create Microsoft Entra Roles**: If you need to create roles for Microsoft Entra users, use a Microsoft Entra administrator account to run the necessary scripts.
124
+
125
+
## Next steps
88
126
89
127
[Manage backup of Azure PostgreSQL - Flexible Server using Azure portal](backup-azure-database-postgresql-flex-manage.md).
0 commit comments