Can azure app service delete folders that created by another instance? - azure

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.

Related

Accessing log files inside docker container

I have a tomcat Docker image -- source
This image has a sample war file that logs some data in a tomcat folder -- in the instance of this image in tomcat/logs
I am deploying this image as a web app using Azure containers -- and that works great, but I was wondering if there was a way to access that tomcat/logs folder?
I can FTP to the web app but I cannot access to the files in the Docker container.
Is there a way to do it?
You first need to enable them. To enable application logging for Linux apps or custom containers in the Azure portal, navigate to your app and select App Service logs. In Application logging, select File System > In Quota (MB), specify the disk quota for the application logs > In Retention Period (Days), set the number of days the logs should be retained > When finished, select Save.
Then you can see container logs in your App Service > Monitoring > Log stream
You can use Kudu to view the logs -Linux/container apps:
https://.scm.azurewebsites.net/api/logs/docker
You may also leverage App Service diagnostics.
To access App Service diagnostics, navigate to your App Service app in the Azure portal> In the left navigation, click on Diagnose and solve problems – Checkout the tile for “Diagnostic Tools” and “Availability and Performance” > "Application Logs" title.

How to delete files created by Azure app service automatically

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

Migrate Windows Service to Azure

We are migrating to Azure. We have a Web App deployed. However, I have a Windows Service that I need to add in to the mix. The service continuously runs, checking the associated Service Bus Queue for messages every 5 seconds.
I am looking for recommendations on how to do this.
I have looked at Web Jobs. But, I don't understand how it gets kicked off. I know there is a Web Hook involved - but I just want the code to run continuously without having to be constantly kicked.
We are also trying to avoid the cost of having a VM involved.
Thanks in advance.
Since you already have a web app, you could use a Azure App Service to run the Web App. The Azure App Service will allow you to also have a Web Job that you can have run on a schedule.
It does not make sense to break you web app into Azure Functions since it is already built. You can have the service run in an Azure Function, but it will probably add more complexity to interact with the web app (if that is what is happening) and if the service is running every 5 seconds, that could get costly.

Azure App Service Kudu tool "LogFiles" Deleted Automatically -- app service for container (linux)

I hosted my dotnet core app on app service for containers and I'm using the standard logging to log http request, but when I check my log files from kudu, it seems that files deleted automatically each day to add new day-file
As example,
on 25/10/2020 I got those files
(22-10-2020_docker_log, 19-10-2020_docker_log, 25-10-2020_docker_log)
and on 26/10/2020 I got those files
(22-10-2020_docker_log, 19-10-2020_docker_log, 26-10-2020_docker_log)
Why this happened? is log files deleted daily? I think it should never deleted, isn't it?
Thanks in advance.
Enable application logging by navigating to your app, select App Service logs.
In Application logging, select File System.
In Quota (MB), specify the disk quota for the application logs. In Retention Period (Days), set the number of days the logs should be retained.
Click Save.

Is it possible to perform configuration changes to an Azure Web App without the application restarting?

Currently when pushing updates via our CI/CD pipeline to the Azure Web Apps the nodes are being forcefully rebooted by azure once the configuration changes are completed.
Has anyone come across a way where you can apply a configuration (web.config or other) changes to the web app in a single slot configuration with out the forced restart?
As Fabrizio Accatino said, when you touch the web.config, IIS automatically restarts the app domain.
If you do this to avoid downtime, you could add a deployment slot and publish your newest project to it. When you want to publish your project to production environment,you can swap them.For more details, refer to this article.
If downtime is your concern, it looks like MS starts up another container when you hit Save in the application settings blade, and then transfers all new requests over to the new container. The old container is given 2 min to complete all requests, and is then shut down.
https://social.msdn.microsoft.com/Forums/azure/en-US/f15b207b-c063-46e5-b87a-2b157641c8c4/does-changing-an-app-setting-and-saving-restart-the-app?forum=windowsazurewebsitespreview
I tested this on a Web App by repeatedly hitting an endpoint for 30 seconds while I changed an application setting and hit save. I saw the application start, but did not see any timeouts, only 200 OKs.
FYI my web app only used a single slot.

Resources