Good day, I am trying to backup a Microsoft Azure SQL database using an ASP.Net application programmatically into either a .BACPAC file I can download to a local machine or into an Azure blob storage platform. I know similar questions have been asked before but I have searched the web and cannot find a recent solution that seems to work. A simple "Backup database" SQL query also doesn't seem to be possible as I am constantly thrown with the error message: 'BACKUP DATABASE' is not supported in this version of SQL Server. Any help would be greatly appreciated. Attempt at consuming API
1 Answer
The simplest way i think is to use Databases - Export Rest Api(Exports a database to a bacpac)
The rest api provides you with a blobUri which you can use to download or transfer to Azure blob storage
4 Comments
QuicK
Awesome, that looks just like what I am looking for. Would you by any chance have any example code of how to consume the API?
Nafis Islam
learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/… this is a basic
Call a Web API From a .NET Client tutorial. If my answer is what you were looking for then accept it.QuicK
Could you please look at the edit I made with the attached picture. I am getting an error : "The remote server returned an error: (401) Unauthorized.""
Nafis Islam
storageUri should be some thing like this
"storageUri": "https://test.blob.core.windows.net/bacpacs/testbacpac.bacpac" You only provided location to a sub folder. Try it with postman tool first then with c#
@@VERSION. There are a lot of different SQL offerings now.