I have a code that I have a build pipeline for in Azure DevOps. I also have a Linux WebApp and I have created a folder in the site/wwwroot directory called as test. When I create a release pipeline I want it to released into the test folder and not the default path. Is this possible??
2 Answers
You can use Kudu REST APIs to achieve it. It allows you to specify the location of uploaded files instead of being limited to the default location.
First you should add a Powershell Task to your release pipeline, then write some scripts to invoke and run kudu api to deploy your app. Below is an example:
$WebApp = Get-AzWebApp -Name '<appname>' -ResourceGroupName '<resourcegroupname>'
[xml]$publishingProfile = Get-AzWebAppPublishingProfile -WebApp $WebApp
# Create Base64 authorization header
$username = $publishingProfile.publishData.publishProfile[0].userName
$password = $publishingProfile.publishData.publishProfile[0].userPWD
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$param = @{
# zipdeploy api url
Uri = "https://<appname>.scm.azurewebsites.net/api/zip/site/wwwroot/test"
Headers = @{Authorization=("Basic {0}" -f $base64AuthInfo)}
UserAgent = "powershell/1.0"
Method = "PUT"
# Deployment Artifact Path
InFile = "$(System.DefaultWorkingDirectory)\<artifacts_alias>\drop\<artifacts_name>.zip"
ContentType = "multipart/form-data"
}
# Invoke REST call
Invoke-RestMethod @param
You can refer to this article for more details about kudu api

- 7,930
- 2
- 12
- 32
The simplest way is using the FTP Upload task to upload the extracted files directly to the subfolder under site/wwwroot.
If you zipped the packages before deploying, then you need to add a task to extract the files first. Of course you can also upload the zipped package to server first, then navigate to the location and extract the files to the specific folder manually (site/wwwroot/test
in your scenario).
Reference Use FTPS to deploy your WebApp using Azure DevOps for more information.

- 28,712
- 2
- 33
- 55