title: Why is the ILogger injected in my Azure Function v2 missing the APPINSIGHTS_INSTRUMENTATIONKEY?
body: <p>I have an Azure Function v2, like this:</p>
  
  <pre><code>public sealed class FindAccountFunction
  {
      private readonly IAccountWorkflow m_accountWorkflow;
  
      public FindAccountFunction(ILogger&lt;FindAccountFunction&gt; logger)
      {
          m_logger = logger;
      }
  
      [FunctionName("FindAccount")]
      public async Task&lt;IActionResult&gt; Run(
              [HttpTrigger(AuthorizationLevel.Function, "GET", Route = "v1/accounts/")] HttpRequest httpRequest)
      {
          // Do stuff.
          m_logger.LogInformation("Duuuddde");
      }
  }
  </code></pre>
  
  <p>As described in a <a href="https://stackoverflow.com/questions/54876798/how-can-i-use-the-new-di-to-inject-an-ilogger-into-an-azure-function-using-iwebj">different question</a>, the logger is being injected:</p>
  
  <pre><code>[assembly: WebJobsStartup(typeof(Startup))]
  
  public sealed class Startup : IWebJobsStartup
  {
      public void Configure(IWebJobsBuilder webJobsBuilder)
      {
          // Registers other services...
  
          // -- UPDATE - The AddLogging must be called here --
          webJobsBuilder.Services.AddLogging();
      }
  }
  </code></pre>
  
  <p>Then I trigger my function through an HTTP request and go to the Function's portal on Azure DevOps to see if the logs is actually printed:</p>
  
  <p><a href="https://i.stack.imgur.com/faKZ5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/faKZ5.png" alt="Azure Function&#39;s portal"></a></p>
  
  <p>I only see the logs indicating that the function ran successfully however I do not see my log.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Why is the <code>ILogger</code> injected in my Azure Function v2 missing the <code>APPINSIGHTS_INSTRUMENTATIONKEY</code>?</p>
  
  <p><strong>Update</strong></p>
  
  <p>When I look at the injected <code>ILogger</code>, I can see that the InstrumentationKey of the Application Insights Provider is not set. The same applies for a ctor injected ILogger, but also for the injected <code>ILogger</code> in the Run method.</p>
  
  <p><a href="https://i.stack.imgur.com/udf5A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/udf5A.png" alt="Instrumentation key"></a></p>
  
  <p>For my local tests, the instrumentation key is declared in the <code>local.settings.json</code> file:</p>
  
  <p><a href="https://i.stack.imgur.com/bayDH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bayDH.png" alt="local.settings.json"></a></p>