I have an interesting case. I lost access to an Azure subscription. However, I still have access to publishing an ASP.Net application, because I configured a publishing profile, which still works. Note, that this is nothing illegal - internal company policies regarding VS subscriptions; enough to say, that application is mine, written by me, maintained by me etc.
I need to create a backup of the database, but the only thing I can do is to publish the application. Application obviously have connection string embedded in settings, but I cannot connect to the database due to firewall settings (Azure services only). So I need to find a way to dump the data with a controller and action.
So far I managed to dump most tables manually (eg. var data = context.Table.ToList();
) and then output results into view. However, this won't export internal ASP.Net tables, which I cannot access directly (eg. user/role claims etc.)
Keep in mind, that we're talking about Azure SQL, which differs from the regular SQL Server.
How can I back up the database, so that I can migrate application to a different subscription?
If you also can publish your webapp. You can create a
API
function and invoke it. Something like: https://yourwebsite.azurewebsites.net/backup/start.You can create
PROCEDURE
, and run it to generate.bak
file to blob( The premise is that you need to know blob related information.).Sample code like :
C# SQL Server backup of a remote database to the remote default backup location without direct access to the remote location?