Azure Database for PostgreSQL: "InvalidInputs" error restoring an LTR backup from Azure Backup Vault - database-restore

I am trying to restore an long-term retention (LTR) Azure Database for PostgreSQL database backup using Azure Backup Vault as described in these articles:
https://learn.microsoft.com/en-us/azure/backup/backup-azure-database-postgresql (backup configuration steps)
https://download.microsoft.com/download/9/1/9/91990314-33bd-4eaa-a084-d1f7e6175ee1/AzBkpPostgres_ManualPermissions.docx (indirectly linked by the above article)
The LTR backups are completing without issues, however, restoring them to the Azure Database for PostgreSQL resource leads to an "InvalidInputs" error:
With this in the Activity Log:
"properties": {
"statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\",\"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"InvalidInputs\",\"message\":\"\",\"additionalInfo\":[{\"type\":\"UserFacingError\",\"info\":{\"message\":\"\",\"recommendedAction\":[\"\"],\"code\":\"InvalidInputs\",\"target\":\"\",\"isRetryable\":false,\"isUserError\":false,\"properties\":{\"ActivityId\":\"a7a2867e-8889-41c4-a5cf-37fd1394d3d6-Ibz\"}}}]}]}}",
"eventCategory": "Administrative",
"entity": "/subscriptions/XXXXXXXXXX/resourceGroups/poc-rg/providers/Microsoft.DataProtection/backupVaults/XXXXXXXXXXpoc-psql-bv-2/backupInstances/XXXXXXXXXXpoc-psql-2-backup_restore_test_2",
"message": "Microsoft.DataProtection/backupVaults/backupInstances/ValidateRestore/action",
"hierarchy": "30ff29b8-a165-42a0-a594-f726229a5954"
},
Restoring to an Azure Storage Account leads to this error:
"properties": {
"statusMessage": "{\"status\":\"Failed\",\"error\":{\"code\":\"ResourceOperationFailure\",\"message\":\"The resource operation completed with terminal provisioning state 'Failed'.\",\"details\":[{\"code\":\"SMAWTeeInternalError\",\"message\":\"Microsoft Azure Backup encountered an internal error.\",\"additionalInfo\":[{\"type\":\"UserFacingError\",\"info\":{\"message\":\"Microsoft Azure Backup encountered an internal error.\",\"recommendedAction\":[\"Wait for a few minutes and then try the operation again. If the issue persists, please contact Microsoft support.\"],\"code\":\"SMAWTeeInternalError\",\"target\":\"\",\"isRetryable\":false,\"isUserError\":false,\"properties\":{\"ActivityId\":\"a7a2867e-8889-41c4-a5cf-37fd1394d3dd-Ibz\"}}}]}]}}",
"eventCategory": "Administrative",
"entity": "/subscriptions/XXXXXXXXXX/resourceGroups/poc-rg/providers/Microsoft.DataProtection/backupVaults/XXXXXXXXXXpoc-psql-bv-2/backupInstances/XXXXXXXXXXpoc-psql-2-backup_restore_test_2",
"message": "Microsoft.DataProtection/backupVaults/backupInstances/ValidateRestore/action",
"hierarchy": "30ff29b8-a165-42a0-a594-f726229a5954"
},
I have tried with both Azure Database for PostgreSQL versions 10 and 11. The azure_backup role is granted the following permissions:
ALTER USER azure_backup WITH CREATEDB;
GRANT azure_pg_admin TO azure_backup;
Any insight or help is appreciated.
Thanks!

We have fixed this issue in the September update of 2021. Please re-try with the latest version.

Related

Azure configure backup doesn't see PostgreSQL

I am trying to configure a backup of the PostgreSQL server using the Azure backup center.
I created Vault, a resource group. But when I am trying to configure backup using Vault and Backup policy it can't see the PostgreSQL database server in the resources.
I appreciate any help in troubleshooting the issue.
enter image description here
Please follow the official document troubleshooting the issue:
Select or Create a Backup Policy that defines the backup schedule.
+ Add and select PostgreSQL database
Note:
The backup service validates the necessary access permissions to read secret details from the key vault and connect to the database
if access permission is found missing, it will display an error message- role assignment not done, make sure to check and Re-validate role assignment done or not.
Reference:
https://learn.microsoft.com/en-us/azure/backup/backup-azure-database-postgresql-overview#grant-access-on-the-azure-postgresql-server-and-key-vault-manually
https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/concepts-backup-restore

Azure Database for PostgreSQL server backup before destroy

I currently have an Azure PostgreSQL server which I would like to permanently delete.
For obvious reasons I would like to make a snapshot/soft delete before turning off and deleting. What is the simplest way to accomplish this? I know there is a backup center option but I feel this is rather sophisticated for what I need.
Thanks
You can take the backup of Azure PostgreSQL server on the Azure Storage Account, then download the backup file locally from the storage account. After that you can delete the storage account and Azure PostgreSQL server.
Below is the article that shows how to take back up on Blob Storage.
Backup Azure Database for PostgreSQL to a Blob Storage

403 Forbidden using mongorestore for Cosmos DB

I am trying to restore a dumped DB on Cosmos using mongorestore command but unfortunately it is throwing an error as follows:
error running create command: (Unauthorized) Error=13, Details='Response status code does not indicate success: Forbidden (403); Substatus: 0; ActivityId: 421d33eb-dea0-4372-92b0-ece63fd2b357; Reason: ("Operation 'POST' on resource 'dbs' is not allowed through Azure Cosmos DB endpoint. Please switch on such operations for your account, or perform this operation through Azure Resource Manager, Azure Portal, Azure CLI or Azure Powershell"
ActivityId: 421d33eb-dea0-4372-92b0-ece63fd2b357, Microsoft.Azure.Documents.Common/2.11.0, Please see CosmosDiagnostics, Windows/10.0.14393 cosmos-netstandard-sdk/3.3.2);
2020-08-25T20:47:42.088+0530 0 document(s) restored successfully. 0 document(s) failed to restore.
I am following this link provided by Microsoft to migrate data: https://azure.microsoft.com/en-in/resources/videos/using-mongodb-tools-with-azure-cosmos-db/
The command used for restoring the DB is as follows:
mongorestore --host HOSTNAME:PORT -u USERNAME -p PASSWORD --db DBNAME DUMPED_DB_DIRECTORY_PATH --ssl --sslAllowInvalidCertificates
Which account it is referring to enable the operation and How do I enable the operation on my account as highlighted by the logs ? Is there any equivalent of mongorestore in Azure CLI or Portal ?
I tried restoring a single collection also but the same error came up. I was successfully able to dump the data from my another Cosmos DB instance.
It was a problem from the Azure policy side. The Azure policy respective to the Cosmos DB which prevents key based metadata write access was enabled hence, not able to do any changes in the DB. The organisation put that policy in place, now it is resolved after disabling the policy.

How to take backup of azure SQL-Managed Instance backup to azure blob

I am having a SQL-Managed Instance database now I wanted to take backup in .bak format to blob storage. The current Command I am using is
WITH IDENTITY = 'SHARED ACCESS SIGNATURE'
, SECRET = 'Pasted my sas token generated from azure portal blob storage'
go
BACKUP DATABASE [DB_Name]
TO URL = 'blob url/cointainer name/testing.bak'with checksum;
But by this I am getting a error:
"BACKUP DATABASE failed. SQL Database Managed Instance supports only COPY_ONLY full database backups which are initiated by user."
I have also tried to give "COPY_ONLY" instead of checksum but then again I am facing a error:
"Msg 41922, Level 16, State 1, Line 6
The backup operation for a database with service-managed transparent data encryption is not supported on SQL Database Managed Instance.
Msg 3013, Level 16, State 1, Line 6
BACKUP DATABASE is terminating abnormally.
"
Note: I have a database of approx size 800GB
To prevent the original error message and you are comfortable with the increased security risks you can remove encryption:
Alter database [database_name] set encryption Off
use [database_name]
DROP DATABASE ENCRYPTION KEY
The backup command should be:
USE [master]
BACKUP DATABASE [SQLTestDB]
TO URL = N'https://msftutorialstorage.blob.core.windows.net/sql-backup/sqltestdb_backup_2020_01_01_000001.bak'
WITH COPY_ONLY, CHECKSUM
GO
You could follow this Azure tutorial:
Quickstart: SQL backup and restore to Azure Blob storage service:
It will help you backup the database(.bak) to Blob Storage step by step:
Create credential
Back up database
Hope this helps
Error is related to service managed TDE encryption since all database by default encrypted and service managed TDE does not allow to take copy_only backups. You need to either disable service managed TDE or Enable TDE with customer managed keys to take backups.
Since your database size is 800 GB and if BackupSize > 200 GB then split your backups to multiple files. This is a limitation with blockblob.

Unable to see Procedures item in a schema in Microsoft Azure PostgreSQL

I developed a stored procedure in PostgreSQL in my local machine. And going to deploy it to PostgreSQL in MS Azure. But it's so strange, I did not see "Procedure" item inside a schema.
In Azure
In my local
I guess the user I have used in Azure does not have some permissions to view "Procedures".
If you know about this, please advise me.
Thank,