title: Application insights: no data for dependency calls
body: <p>ASP.NET site hosted on Azure VM. ApplicationInsights Status Monitor installed on VM. Default ApplicationInsights.config created by "Add AppInsights" menu in Visual Studio, only custom initializer added instead of ikey:</p>
  
  <pre><code>&lt;Add Type="WebSite.WebSiteTelemetryInitializer, WebSite" /&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>public class WebSiteTelemetryInitializer : ITelemetryInitializer
      {
          public void Initialize(ITelemetry telemetry)
          {           
              TelemetryConfiguration.Active.InstrumentationKey = WebConfigurationManager.AppSettings["ikey"];
  
              telemetry.Context.User.Id = Environment.UserName;
              telemetry.Context.Session.Id = Guid.NewGuid().ToString();
              telemetry.Context.Component.Version = typeof(WebSiteTelemetryInitializer).Assembly.GetName().Version.ToString();
          }
      }
  </code></pre>
  
  <p>All works as expected, but there is no performance data (Cpu, memory). After adding apppool user to <code>Performance Monitor Users</code> group:</p>
  
  <pre><code>$group = [ADSI]"WinNT://$Env:ComputerName/Performance Monitor Users,group"
  $ntAccount = New-Object System.Security.Principal.NTAccount("IIS APPPOOL\DefaultAppPool")
  $strSID = $ntAccount.Translate([System.Security.Principal.SecurityIdentifier])
  $user = [ADSI]"WinNT://$strSID"
  $group.Add($user.Path)
  </code></pre>
  
  <p>there is no data for dependency calls.</p>
  
  <p><strong>UPDATE</strong>
  There are 3 repeating trace logs:</p>
  
  <ol>
  <li>AI (Internal): Complete creating shadow copy of extension,
  extensionBaseDirectory: C:\inetpub\wwwroot\site\bin, extensionName:
  Microsoft.ApplicationInsights.Extensions.Intercept with error <code>System.UnauthorizedAccessException: Access to the path 'C:\Windows\system32\config\systemprofile' is denied.</code></li>
  <li>AI (Internal): Extension attach failure, unable to attach, baseFolder: C:\inetpub\wwwroot\site\bin, nativeExtensionName: Microsoft.ApplicationInsights.Extensions.Intercept</li>
  <li>AI (Internal): [msg=RemoteDependencyModule failed];[msg=System.InvalidOperationException: Failed to attach extension, hresult: 2147500037 </li>
  </ol>