My app service has an export scenario which extracts data from backend and writes to app service file storage first and egress the data to the blob later. These files are huge and sometimes more than 1GB of size. The current SKU of the app service is supporting 250GB and often running into storage problems because of these temp files creation.
Is there a way I could delete these files programmatically through kudu or may be by exposing another delete end point to delete selective files from the server?
How to delete files created by Azure app service automatically
You can delete files in Azure Web app service created by using kudu console by following the below work-around:
Then click on GO:
Then click on Debug Console:
Then click on CMD:
Then Click on delete:
Other References to delete files are:
Deleting old web app logs using Azure Web Jobs and PowerShell (swimburger.net)
Interacting with Azure Web Apps Virtual File System using PowerShell and the Kudu API – Kloud Blog
Related
We have logs on our application server hosted in Azure cloud. We want to show the logs to the customer who does not have access to the application server directly. We decided to use Azure sync to synchronize the logs from the app server to Azure File storage and enable view those logs from Azure Storage Explorer. The sync all works fine, but I am unable to sort the logs based on modified date-time. Our production server has 1000s of log files and it is not easy to search through the files to check logs. Any idea how to bring the modified date-time in Storage explorer? Or Is there any another approach?
In the Azure file explorer App, fileshares don't have the date column, only Blob containers do, indeed.
However, if you mount the fileshare as a drive on your computer, you'll get the date info and will be able to sort.
The command script (Powershell) to mount the fileshare as a drive on Windows is available in the Azure portal.
We have Azure app service that is configured auto scale up/down depending on some criteria.
Application hosts in app service will download big files from Azure blob storage to
local 'D:\home' to process
Application will clean up those temp files after successfully/failed process.
However, when app service scale down, the temp files downloaded by scaled down app service are not cleaned up, and eventually run out of space for those remaining app service.
Questions:
Can remaining running app service delete those files/folders that were downloaded/created by another app service instance (and those app services instance are gone because of scale down)? All of those files/folders downloaded/created be different app service instances are in the same 'D:\home'.
If there is a way to detect app service is shutting down, clean up those temp files/folder before it finally shut down?
1- There's no ready to use feature like that. You can try implementing one using alerts from Azure Monitor and / or create a WebJob that will keep monitoring the temp folder
https://learn.microsoft.com/en-us/azure/azure-monitor/platform/alerts-classic-portal
2- as far as I know, there's no event that is raised for that.
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
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.
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.
I successfully created a backup file from my first app service using an Azure feature.
Is it possible to restore the backup file to another app service?
If not, is there a way to download the backup file, upload then extract it to the other app service? Please advise.
Yes, you can restore a backup of a web app to another one. But, you need to do more than just clicking the Restore Now button.
Log into the new Portal, on the Settings blade of your web app, click Backups, choose the backup you want to restore, and copy the file location. It would look like this:
https://<your storage account name>.blob.core.windows.net/<your container>?sv=2015-04-05&sr=c&sig=fieQjleVYxDuXG2Ym8yjPpbdPxHOnbiLo8HcRuxyluw%3D&st=2016-04-05T02%3A35%3A25Z&se=2290-01-18T02%3A35%3A25Z&sp=rwdl
From the above URL, you can format a link to download the backup file, by adding the file name after the container name. Here is a link to the zip file:
https://<your storage account name>.blob.core.windows.net/<your container>/<your web app>.zip?sv=2015-04-05&sr=c&sig=fieQjleVYxDuXG2Ym8yjPpbdPxHOnbiLo8HcRuxyluw%3D&st=2016-04-05T02%3A35%3A25Z&se=2290-01-18T02%3A35%3A25Z&sp=rwdl
Download the files with the above link. You get a zip file. Since you are restoring it to a different web app, you can ignore the xml and the log files.
Unzip the zip file, and you will see a .bacpac file, a meta file, and a "fs" folder. You can ignore the meta file.
You can use Visual Studio or SSMS to restore the .bacpac file to a database linked to your new web app.
For files inside the "fs" folder, you can use a ftp client to upload it to your new web app. Don't forget to change the connection string, before uploading.
In fact, it's quite complicated. If you are just restoring a quite recent version of your web app. I suggest you skip step 6, and use your most favorite deploy method to deploy it to you new web app.
If you just want to clone a web app, you can do it through the new portal. For more information, see Azure App Service App Cloning Using Azure Portal
I have deployed my web app and the cloud service on windows azure. Web app saved some of the image files on its own directory lets say on root of the website there is folder name "Content" and web app save the image files on this folder. is there a way a cloud service can access files inside that folder? cloud service is separate project and hence has its own url and hosted on windows azure portal.
AFAIK, it is not possible to share files stored in a web app with a cloud service. What you should do instead is save the files in Blob Storage. That way both Web App and Cloud service can have access to the files.
Another option you have is Azure File Services, you will have the chance to used as a network shared location.
take a look at this here:
https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-files/