0
votes

We have two different app service applications in azure which uses same code other than 3 config files. I am currently deploying through release pipeline using Azure app service deploy task (skipping the config files in additional arguments).

The 3 config files are placed in 2 different folders inside another folder azure devops vsts repository.

Is there any other task/powershell script/ftp upload to copy the 3 config and settings files after the deployment task in release pipeline.

2
It's not entirely clear to me what your set-up or requirements are here. Maybe you could post some screenshot(s) of the pipeline and/or directory structure to make it clearer what exactly you're trying to achieve.alv
@Shekar Not get your latest information, is the workaround helpful for you? Or if you have any concern, feel free to share it hereHugh Lin

2 Answers

0
votes

Is there any other task/powershell script/ftp upload to copy the 3 config and settings files after the deployment task in release pipeline.

As Hugh suggested, you can use PS task to call Kudu api to upload files to Azure App service. Here's one similar issue I once answered.

However I think you can also consider another direction:

We can unzip the .zip which is to be deployed=>add those files(web.config, log4net.config) to the extracted folder=>archive the folder again=>deploy the newly archived zip file to azure app service.

0
votes

As workaround , you need to checkout the repo where the config file is located to the current source. If you are using yaml pipeline, you can define checkout step in yaml file, By this, you can fetch and check out other repositories in addition to the one you use to store your YAML pipeline. If you are using classic pipeline, you can do this by writing a script: git clone https://github.com/Microsoft/TypeScript.git. If the repo is not public, you will need to pass authentication to the Git command.

Then the simple way is using Kudu REST API to copy file to azure app service.

Example code:

function Upload-FileToWebApp($kuduApiAuthorisationToken, $webAppName, $fileName, $localPath ){

    $kuduApiUrl = "https://$webAppName.scm.azurewebsites.net/api/vfs/site/wwwroot/app/resources/$fileName"
    
    $result = Invoke-RestMethod -Uri $kuduApiUrl `
                        -Headers @{"Authorization"=$kuduApiAuthorisationToken;"If-Match"="*"} `
                        -Method PUT `
                        -InFile $localPath `
                        -ContentType "multipart/form-data"
}

In addition, here is a ticket you can refer to.