0
votes

I have a scenario where I need to perform XML Transformation for Web.config & ConnectionStrings.config files of my .Net MVC project. My requirement is to perform this from my Azure CICD pipeline.

I am using Azure web apps to host my web application. I cannot use the Azure Web App Deploy task, as am deploying the files using FTP upload.

I am looking for a solution where I can transform these configs directly on the web apps from the release pipeline.

In my case, we are setting up a sitecore platform and the infrastructure is provisioned based on an ARM template. After provisioning, a base web app gets created with all the connectionStrings and web configs prepopulated. And What i am trying is to transform these pre-populated config files at the time of release.

Thanks in Advance.

1
Azure Dev Ops (formerly VSTS) have releases that can do that if you use them to deploy you web apps. You will either have to do the transform on build using config file transforms or use Azure release to deploy and update the connection string.Shahid Syed
Thanks @Shahid Syed. In my case, we are setting up a sitecore platform and the infrastructure is provisioned based on an ARM template. After provisioning, a base web app gets created with all the connectionStrings and web configs prepopulated. And What i am trying is to transform these pre-populated config files at the time of release.Leo Varghese
@LeoLiu-MSFT The answer given by Shahid below helps in performing the transformation and Token replacement. What I did in my case is that, I will download the existing web.config file from the web app, transoform it and the uploads the updated file again to the web app. This is how I resolved my issue. Any other approaches is appreciated.Leo Varghese
@LeoVarghese, Glad to know you have resolved your issue, you can share your solution as answer, so it could help other community members who get the same issues. Thanks.Leo Liu-MSFT

1 Answers

2
votes

How to automate XML transformation for web.config & connectionStrings.config files from Azure CICD pipeline?

If you cannot use the Azure Web App Deploy task, you can try to use the XDT Transform extension that can apply transform for config file.

So, you could get the related configure files in release artifact, then configure transform per to release environments.

On the other hand, you can replace the value in configure file through Replace Tokens task.

Hope this helps.