Troy
Troy

Reputation: 81

How do I protect a target Directory in Azure from deployment

I am using VS Team Services to build and deploy my Asp.net MVC application to Azure. When the application is running, users can upload files to a directory.

The problem is that when I run a new build and deploy task in Team Services it overwrites or deletes the files that were uploaded by my users.

It seems like Team Services erases the target location before it does the deployment.

Is there a way in Team Services to tell it not to delete a specific directory when it is deploying an update to the application?

If I cant do that then is there a way to automate the copying of the original files before the deployment, then write them back after the deployment?

I've been searching google most of the day and cant seem to find an answer.

Thanks Tony

Upvotes: 1

Views: 134

Answers (2)

starian chen-MSFT
starian chen-MSFT

Reputation: 33708

There is Remove Additional Files at Destination option in Additional Deployment Options of Azure App Service Deploy step/task.

So If you check this option, it will delete additional files on AzureRM Web APP otherwise, it won’t delete additional files. enter image description here

Upvotes: 2

bougiefever
bougiefever

Reputation: 1265

I believe there is a better approach. Your user data should be saved to Azure blob storage, not uploaded to the web deployment location.

Here is a good getting started tutorial on using Azure storage: https://learn.microsoft.com/en-us/azure/storage/storage-dotnet-how-to-use-blobs

It is not recommended for user files to be stored in the same directory as the web site. Even if you simply load them into file storage on your VM, it should be in its own location.

Upvotes: 2

Related Questions