Copy file to Azure App Service During Release Pipeline
Asked Answered
M

2

5

During the Azure Release pipeline, I would like to copy a file in a Git repo to the wwwroot directory in the app service. The output from the task says it copies the file but it is not there. I am thinking I am not specifying the target folder properly. I currently have it as d:\home\site\wwwroot. Thanks for any help.

Mourner answered 14/1, 2020 at 13:12 Comment(0)
J
5

Copy file to Azure App Service During Release Pipeline

You could not use the copy task to copy a local file to the Azure app service. This task only supports local replication.

When you set it as d:\home\site\wwwroot, the copy task will copy the file to the folder in the agent, which runs this task rather than the Azure app service.

To resolve this issue, you could use Azure App Service Deploy task to deploy this file to the app service. In this task, set "Package or folder" path to the folder where the file exists.

Or you can consider the advice of Leo Varghese, to use the FTP upload task to copy that file to the app service.

Hope this helps.

Jessicajessie answered 16/1, 2020 at 2:57 Comment(0)
N
2

@Doug, You an make use of the FTP upload task to copy a file in your build artifact to the wwwroot folder. Assuming your file in gitlab is present inside the artifact after the execution of build pipeline.

Please refer this article -> https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/ftp-upload?view=azure-devops

For performing FTP upload you will need your FTP credentials available for your web-app. This can be obtained from the Deployment Center of your web app.

Hope the above answers your question. Please let me know if you have any queries on this.

Noodle answered 15/1, 2020 at 9:27 Comment(3)
Thank you both for your answers. I think I will simply have to do this manually. What I am trying to upload is an apple pay validation file. You have to have one for each website or environment and the filename is generated with the same name. So we have three environments meaning I would have to have three files in my build but they would have to have different names, then copy the right one into the folder apple is expecting and rename it. What i was really hoping to do was to keep the files outside of the build and load from a separate config like repo.Mourner
@Mourner Azure DevOps also offers a feature called Secure Files. Which is available in the Library module in Azure DevOps. If your file is not a dynamic one, you could store your files in secure files specifically for different environments. Also you have tasks in ppeline to download file from from secure file and then upload it to wwwroot. Thus you can avoid including the files in the build artifact. I think this functionality should also be considered.Noodle
Thank you for the suggestion. I will check it out.Mourner

© 2022 - 2024 — McMap. All rights reserved.