is it possible to restore DB to azure sql from backup file's url using an Azure API?

734 Views Asked by At

i'm reading about doing the restore to azure sql using azure management studio using T-SQL queries:

https://msdn.microsoft.com/en-US/library/jj852091.aspx

RESTORE DATABASE AdventureWorks2012 
FROM URL = 'https://mystorageaccount.blob.core.windows.net/privatecontainertest/AdventureWorks2012.bak' 
WITH CREDENTIAL = 'mycredential';
, STATS = 5 – use this to see monitor the progress
GO

Is there a way to do this programmatically using an azure API?

1

There are 1 best solutions below

3
On

Yes, you can use the Azure REST API to restore. The following link shows the ways to restore a deleted database:

Restore Deleted Database Tutorial through REST

You can build and send a POST request to the following URL with your subscription ID and server name.

https://management.core.windows.net:8443/{subscriptionId}/services/sqlservers/servers/{serverName}/restoredatabaseoperations

Cheers, Luis