Not able to delete files from the Kudu Console on an App Service
Kudu is the engine behind a number of features in Azure App Service related to source control based deployment, and other deployment methods like Dropbox and OneDrive sync.
Access Kudu for your app
Anytime you create an app, App Service creates a companion app for it that's secured by HTTPS.
Reference: https://learn.microsoft.com/en-us/azure/app-service/resources-kudu
There may be a scenario where we may face issues while deleting the files on the Kudu Console(both from UI and cmd). The error might appear as a 404 Not Found error on UI. When we try to delete the files using the “del <filename>” command, it will be showing the error “Access Is Denied”. The issue might be very intermittent in nature, sometimes we might be able to delete it, sometimes not. Even when there are no locks and even when we have a Contributor access, this error might still pop up.
The error will appear like this:
When we try deleting the files, adding the files and even updating the files; at the time of failure ,nothing works. Even the attrib command does not work at that time. Restarting the app and stopping the app and deleting it also does not work. One thing to note is that there will be a lot of files present in the Kudu Console.
CAUSES
- This might occur when the application is constantly switching to the Read-only volume which can cause the deleting operations to fail. The behavior is because of the high number of I/O operations being performed continuously which can be causing latencies.
- Due to the constantly increasing latencies caused by extensive logging, the App Service platform moves to the read-only volume.
WORKAROUND
- If our main concern is to delete the files, we can enable the App Setting, WEBSITE_DISABLE_STANDBY_VOLUMES = 1.
- On Adding this setting, the App Service will be forced to use the Read-Write primary volume which will allow us to delete the files.