Search code examples
azureazure-devopsazure-webapps

Does Azure Web App support string/token replacement in config files?


I have a Web App that I deploy via YAML pipeline, but would like to see if it can be done via web app's Deployment Center.

I need to transform the IP address and userPrincipalName in the endpoint element, but it does not fall under AppSettings or connectionstring element. Is it possible to transform this kind of element via Web App, or am I stuck with YAML pipeline?

Here is snippet of my config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="API_AUTH_MODE" value="2" />
  </appSettings>
  <system.serviceModel>
    <client>
      <endpoint address="net.tcp://10.0.0.0:99/App1/Services/Service1"
        binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Service1"
        contract="Service1" name="NetTcpBinding_Service1">
        <identity>
          <userPrincipalName value="user@domain.local" />
        </identity>
      </endpoint>
      <endpoint address="net.tcp://10.0.0.0:99/App1/Services/Service2"
        binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Service2"
        contract="Service2" name="NetTcpBinding_Service2">
        <identity>
          <userPrincipalName value="user@domain.local" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>

Solution

  • While it was answered correctly above - Web App cannot transform anything other than Appsettings or 'connectionstring`, I ended up doing the following:

    • Use XML Transform files to replace the strings needed, since there is dependency on build type
    • Use YAML file to access vault to do password replacements.

    I could have used Web App to do the password replacements, but it is much easier to manage the pipeline/deployment/release via a single YAML file rather than split YAML and Web App.