0
votes

I have an Azure DevOps release pipeline, deploying my code using Web Deploy to Azure Web app to different environments (Dev/ SIT/ UAT/ PROD). Now, I need to include a task to copy/ rename one Configuration file (environment specific), which is inside 'Config' folder, to another file inside the same folder. Please note, the config file is not under the root folder of the web app.

Is there a way to accomplish this using 'post deployment action' or command line script task? I couldn't understand how can I refer the source folder of the web app for the copy operation. I was referring the following page but couldn't find one that will help me to achieve the task. Any help is appreciated.

https://docs.microsoft.com/en-us/azure/devops/pipelines/release/variables?view=azure-devops&tabs=batch

1
Having different configuration files per environment is entirely the wrong approach. You have a multitude of better options: 1) Keyvault 2) Azure App Configuration 3) Azure web app settings (which override config file values automatically in most applications) 4) Deployment-time configuration transforms.Daniel Mann
@DanielMann thanks for the insights on different options for config files, but I wanted to know in general for any files, not restricted to *.config. I will try #4 as this is the most suitable in this existing environment, I was wondering if the transformation will still be possible for *.config files inside a subfolder. Like 'wwwroot/mysubfolder/abcd.config', I will try this out later today.UBK

1 Answers

0
votes

The Post deploy action script is running on azure (through Kudu API): Command

So, if the file is existing on the azure web app, you could copy it through Post deploy action script, for example, Site.css is in wwwroot\Content folder after deploying, then the script could be like this:

Copy Content\site.css Content\site1.css /a

Otherwise, you could store the necessary data in App settings or Configurations of Azure Web app.