Delete existing files from Kudu /site/wwwroot/ before new Azure app deployment - azure

I'm trying to delete my previous app deployment files present in kudu /site/wwwroot/ before a new Azure deployment. I tried running the curl command with delete method -
curl -u username:password -X DELETE "https://{web-app-name}.scm.azurewebsites.net/api/vfs/site/wwwroot/"
But I got the following error :-
Cannot delete directory. It is either not empty or access is not allowed
Any idea how I can delete the files via the terminal window without actually having to manually delete them?
Any help would be greatly appreciated, Thanks!

If you are using Visual Studio for deployment you can check this box before deployment,
Or you can use Powershell script by calling Kudu VFS API
DELETE
https://{site}.scm.azurewebsites.net/api/vfs/wwwroot/some.config.default

Related

SMB Client on azure server not deleting file from azure storage

I have a flask webapp running on an Ubuntu Azure sever. I also have an azure storage account, and to access the storage from the webapp, I use SMB. This has worked so far, with adding and updating files on the server, but I tried to delete a file and it didn't work. No error or anything, it just did nothing and the file is still on the server. I tried the command locally and it worked fine. Is there something I'm doing wrong and how could I fix this problem. Here's the command I've been using:
smbclient //name.file.core.windows.net/website -mSMB3 -e -Uname%password -c 'rm tempplugins/test2.ini'
This may not solve your exact problem, but I was attempting to perform operations on a file share on an Azure Storage Account from an Azure VM running CentOS, and I ran into several different problems. It took me a while to get the kinks worked out.
In my case, I had to use to use backslashes, but I had to double them so that they were escaped properly. Example:
smbclient \\\\storageaccount.file.core.windows.net\\sharename
Additionally, we weren't using an integrated active directory, and so we had to use the storage account name as the username and it had to be "prefixed" with "Azure" like "Azure\storageaccount". And don't forget that backslashes have to be doubled! Also, the password was the storage account key. Example:
smbclient \\\\storageaccount.file.core.windows.net\\sharename -U Azure\\storageaccount%key
I used the "-d" option to debug the command line options for smbclient. However, in my case, the "-d" option had to be on the end of the command or it interfered. If it hadn't been for the clues provided by "-d", I never would have gotten this to work. Example:
smbclient \\\\storageaccount.file.core.windows.net\\sharename -U Azure\\storageaccount%key -d
Here's a simple, one-liner that shows a directory of a file share on an Azure Storage Account. Example:
smbclient \\\\storageaccount.file.core.windows.net\\sharename -U Azure\\storageaccount%key -c dir -d
I hope that this helps someone else as I must of blown 2 to 3 hours to get this worked out.

build.artifactstagingdirectory doesn't exist Azure Devops

I'm trying to publish a ClickOnce application. To do so, I'm building the project with the msbuild publish target argument, copying the files to the artifact staging directory, then attempting to upload that directory via FTP.
However, the ftpupload task is failing:
With the following error:
550 The system cannot find the file specified.
For whatever reason, removing the / at the begging of the Remote Directory field fixed it. Most say the / at the beginning is needed, however. It might vary from one FTP server to another.
550 The system cannot find the file specified.
This error doesn't indicate that the specified files are missing in build.artifactstagingdirectory folder.
Actually the task would always succeed with the warning Could not find any files to upload even when the build.artifactstagingdirectory folder is empty:
To make the FTP upload task work successfully, you may need to check your Remote directory input of that task and make sure your FTP remote Server is configured well.
1.Assuming your remote home directory is C:\FTPfolder. You should use /TestFolder/as input if you want to upload the files to C:\FTPfolder\TestFolder. (Be careful about the slash)
2.If your upload task would create a new folder in remote directory during this process, you should make sure the user account has the related directory access like creating sub-folders...
PS: I run this pipeline in my self-hosted agent to upload files to remote directory in remote machine with Serv-U ftp server. The task works well in my side.

Error 34513 when trying to re register Azure Backup Server

I have tried downloading the MARS agent, new backup credentials and checked my server time as well as 20 other things. I still get error 34513 when trying to re register my Azure backup server. Anybody??
Delete the files inside C:\Windows\Temp
Reboot the Machine Locate
Locate the Credentials File on C:\ - not on the Desktop, not on a Network Share
Try again, have fun!
For more information: https://azure.microsoft.com/en-in/blog/troubleshooting-common-configuration-issues-with-azure-backup/

Azure Deployment error involving New Relic Extension?

I have been using the Git deployment in Azure with some success but today I am getting an odd error message that is pointing to my New Relic extension being busy.
KuduSync.NET from: 'C:\DWASFiles\Sites\mySite\Temp\c974b345-d98d-4fa4-967a-24c5d3318f63' to: 'D:\home\site\wwwroot'
Error: The process cannot access the file 'D:\home\site\wwwroot\newrelic\NewRelic.Agent.Core.dll' because it is being used by another process.
Copying file: 'Web.config'
Copying file: 'newrelic\NewRelic.Agent.Core.dll'
Failed exitCode=1, command="kudusync" -v 50 -f "C:\DWASFiles\Sites\mySite\Temp\c974b345-d98d-4fa4-967a-24c5d3318f63" -t "D:\home\site\wwwroot" -n
"D:\home\site\deployments\b0cafe3c6458e4bd3b597f91c7dbada951e87ef8\manifest" -p
"D:\home\site\deployments\fe17821502ade78d0242c1992ea0841e48e2dce4\manifest" -i
".git;.hg;.deployment;deploy.cmd"
An error has occurred during web site deployment.
Has anyone else seen this and figured out how to fix it?
There is a known issue with Azure Web Sites where the DLL files are locked due to being in use (since the site is running).
In the Azure portal you can force Azure to unload the profiler DLL file by setting the app setting COR_ENABLE_PROFILING to 0 and hitting save. This will restart IIS and unload the DLL without users seeing any error (just a delay in getting the site). After you make changes you can set it back to 1 and it will start the agent back up. This can also be done via Azure PowerShell.

Where is the log file using Production profile with NServiceBus GenericHost and default log4net settings when installed as a service?

I have a very simple NServiceBus.Host.exe application that is using the default logging and the Production profile. According to the documentation, this should result in an appending file log that should appear in the same folder as the EXE. However, when I run the application as a service, the log file doesn't appear in the same folder as the EXE, and thus far I've been unable to locate it at all. The service is running as Local System. Do I need to run it as a user account and look for the file in the AppData folder somewhere? Is it under c:\windows somewhere? Where is it and is there a way for me to have it actually log to a file in the same folder as the EXE as advertised?
Update:
Using ProcMon and ProcExp from SysInternals, I can see that there is no attempt to create any log file in the folder where my EXE exists, nor are there any file permission errors while trying to create a log file anywhere, at least not from the PID of the service (if for some reason log4net spins up another process to do this work then I might have missed it).
It turns out that the service wasn't actually running in the Production profile. I had for some reason gotten it into my head that services would run in the production profile by default, while running it in interactive mode would use Lite by default. Not so - the service will use the Lite profile unless you specify otherwise. I changed my command to install the service from:
NServiceBus.Host.exe /install /displayName:MyService
to
NServiceBus.Host.exe /install /displayName:MyService NServiceBus.Production
and this fixed the issue.

Resources