title: Adding custom property to all Application Insight traces
body: <p>I want to add a custom property to all traces in Application Insights.</p>
  
  <p>In Asp.Net Core I've added this code</p>
  
  <pre><code>internal class TelemetryProperties : ITelemetryInitializer
  {
      private IConfiguration configuration;
  
      public TelemetryProperties(IConfiguration configuration)
      {
          this.configuration = configuration;
      }
  
      // TODO: Not being added to all traces.
      // http://apmtips.com/blog/2014/12/01/telemetry-initializers/
      public void Initialize(ITelemetry telemetry)
      {
          var applicationName = configuration["Application:Name"];
          telemetry.Context.Properties.Add("Application", applicationName);
      }
  }
  </code></pre>
  
  <p>and in the configure method of Startup.cs I have added:</p>
  
  <pre><code>TelemetryConfiguration.Active.TelemetryInitializers.Add(new TelemetryProperties(Configuration));
  </code></pre>
  
  <p>The intent was to add "Application" to all traces, even ones made automatically by Application Insights, but the effect is that it is ONLY being added to my custom traces that Im calling through my code.</p>
  
  <p>How do I add a property to ALL traces, even ones I do not create.</p>
  
  <p>Edit: The purpose of this is that I want to have multiple APIs in the same application insights log, but I want to be able to partition when neccessary by adding a defining property such as application name.</p>