6

We are trying to push a ApplicationInsights key in ApplicationInsights.config via parameters.xml. The parameter does not do his way to the said file.

We build a webdeploy package that is then published to different environnements. All the other parameters are for the web.config and works as expected.

The entry in parameters.xml:

   <parameter name="InsightInstrumentationKey" description="InsightInstrumentationKey">
      <parameterValidation kind="AllowEmpty" />
      <parameterEntry kind="XmlFile"
                      scope="\\ApplicationInsights.config$"
                      match="/ApplicationInsights/InstrumentationKey/text()" />
   </parameter>

The ApplicationInsights.config file:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
  <TelemetryChannel>
    <DeveloperMode>false</DeveloperMode>
  </TelemetryChannel>
  <TelemetryModules>
      [...]
  </TelemetryModules>
  <AccountId></AccountId>
  <InstrumentationKey>HERE GOES THE PARAMETER</InstrumentationKey>
  <ContextInitializers>
      [...]
  </ContextInitializers>
  <TelemetryInitializers>
      [...]
  </TelemetryInitializers>
</ApplicationInsights>

I am now wondering if it is possible at all to have a scrope differente from "web.config"?

1 Answer 1

3

There is a problem whit the xmlns value. Try this:

<parameterEntry kind="XmlFile" scope="ApplicationInsights\.config$"match="/*/*[local-name() = 'InstrumentationKey']/text()"/>
Sign up to request clarification or add additional context in comments.

1 Comment

This was the only solution I found that actually worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.