Hi,
From the documentation:
"Backup data is stored in the Backup vault as a blob within the Microsoft tenant. During a restore operation, the backup data is copied from one storage account to another across tenants. Ensure that the target storage account for the restore has the AllowCrossTenantReplication property set to true."
Basically Azure Backup does not restore directly on the PostgreSQL flexible server. Instead it restores all the backed up files to Storage account:
"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:
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.
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
The Third File _roles. Has roles backed up using pg_dumpall
The Fourth file _schemas. backed up using pg_dumpall
The Fifth file _tablespaces. Has the tablespaces backed up using pg_dumpall
- Post restoration completion to the target storage account, you can use pg_restore utility to restore an Azure Database for PostgreSQL flexible server database from the target. Use the following command to connect to an existing postgresql flexible server and an existing database
pg_restore -h <hostname> -U <username> -d <db name> -Fd -j <NUM> -C <dump directory>
-
-Fd
: The directory format. -
-j
: The number of jobs. -
-C
: Begin the output with a command to create the database itself and then reconnect to it.
pg_restore -h <hostname> -U <username> -j <Num of parallel jobs> -Fd -C -d <databasename> sampledb_dir_format
If you have more than one database to restore, re-run the earlier command for each database." -
Flexible server is like PostgreSQL on VM but without the hassle of managing the VM but still having all the PostgreSQL capabilities thus the restore process is similar to how you will do restore if the PostgreSQL was installed on VM.
From the documentation it is not clear exactly what are the requirements of the storage account but most likely you need type Standard general-purpose v2 in the same location as the vault setting AllowCrossTenantReplication enabled.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.