title: How to get Application Insights operation id in javascript?
body: <p>I have an Azure Function app written in javascript that has Application Insights integrated:</p>
  
  <pre><code>const AppInsights = require("applicationinsights");
  
  AppInsights.setup(appInsightsInstrumentationKey);
  AppInsights.defaultClient.context.tags[
      AppInsights.defaultClient.context.keys.cloudRole
          ] = "My back-end";
  AppInsights.start();
  </code></pre>
  
  <p>The module version is 1.7.4.</p>
  
  <p>I do need to access the current operation id to send it to my custom log for correlation with AI logs in Azure. In my functions I tried this:</p>
  
  <pre><code>var telemetry = appInsights.defaultClient;
  var oid = telemetry.context.tags["ai.operation.id"]; // does not work
  var oid = telemetry.context.operation.id; // does not work
  </code></pre>
  
  <p>Nevertheless, AI collects it somehow so I can see it in Azure portal:</p>
  
  <p><a href="https://i.stack.imgur.com/GHIbY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GHIbY.png" alt="enter image description here"></a></p>
  
  <p>How can I access <code>operation_id</code> value at run-time in my Azure functions?</p>