3
votes

I have a release in VSTS to deploy my webapp to the azure app service. For this I use a Azure App Service deploy step. After the normal deploy of the webapp I want to add an additional zip artifact from another build result. I want to copy only those file to a specific path of the web application on azure. How can I do that?

3
How about you use an FTP upload task?rickvdbosch

3 Answers

3
votes

If the zip file is the web deploy package, you can refer to Joy’s answer. (Need to check Application option)

Otherwise, the simple way is using Kudu REST API (remain folder structure), steps:

  1. Uncheck Publish using Web Deploy option of Azure App Service Deploy task
  2. (Optional) Add Unzip task to extract zip files to a folder in artifact folder (the folder that you want in app service, e.g. D:/1/a/mylib)
  3. Specify folder (parent folder of step 2 to remain folder structure) or package (zip) in Package or folder input box
0
votes

You could use Virtual applications and directories to do it.You could check my steps.

  1. Go to azure portal -> APPLICATION -> APPLICATION SETTINGS->Virtual applications and directories
  2. set virtual directory with virtual path : /YourApplication to site\YourApplicationorsite\wwwroot\YourApplication
  3. Go to VSTS-> the release option-> the Deploy Azure App Service task
  4. set virtual application to /myApplication

Hope it can help you.

0
votes

If using Azure DevOps for your CI then an alternative solution is to zip your file(s) including directory structure from the web root and add them into DevOps as a 'secure file' (find this under library/secure files once you've configured an Azure KeyVault).

Then add a pipeline task to download the secure file (use "Download secure file" task) to your build server. Make sure you add a "Reference name" to this task so you can reference the downloaded file path in a later step.

Then add a stand-alone "Azure App Service Deploy" step to deploy just this zip file. Select deployment method of "Zip deploy" and reference your downloaded secure file in the "Package or folder" section, like $(secureFileReferenceName.secureFilePath).

This effectively downloads the zip file from secure storage to the build agent and unzips it to wwwroot in the App Service.