question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for Application Insights in the Azure Government Cloud [v3.x]

See original GitHub issue

AI with the government cloud requires a change to point to the government AI endpoint:

“ApplicationInsights”: { “InstrumentationKey”: “instrumentationkey”, “TelemetryChannel”: { “EndpointAddress”: “https://dc.applicationinsights.us/v2/track” } } https://docs.microsoft.com/en-us/azure/azure-government/documentation-government-services-monitoringandmanagement#application-insights

We tried the settings below but because the config doesn’t allow changes to the TelemetryChannel+ the EndpointAddress this does not work.

https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/ApplicationInsightsLoggerOptions.cs

{
  "version": "2.0",
   "logging": {
        "applicationInsights": {
            "TelemetryChannel": {
      "EndpointAddress": "https://dc.applicationinsights.us/v2/track"
    }

        }
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jcbrooks92commented, Jul 16, 2019

Updated startup.cs

This should allow log streaming and the other functionality

using System;
using Microsoft.ApplicationInsights.Channel;
using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel;
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.ApplicationInsights.Extensibility.PerfCounterCollector.QuickPulse;
using Microsoft.ApplicationInsights.Extensibility.Implementation.ApplicationId;
using Microsoft.ApplicationInsights.Extensibility;
using System.Collections.Generic;
using Microsoft.ApplicationInsights.AspNetCore;
using Microsoft.Extensions.Options;
using System.Linq;

[assembly: FunctionsStartup(typeof(FunctionV2DotNet.Startup))]

 namespace FunctionV2DotNet

{
    public class Startup : FunctionsStartup
    {
        public override void Configure(IFunctionsHostBuilder builder)
        {
            builder.Services.AddOptions<TelemetryConfiguration>()
     .Configure<IEnumerable<ITelemetryModuleConfigurator>, IEnumerable<ITelemetryModule>>((telemetryConfig, configurators, modules) =>
     {
         // Run through the registered configurators
         foreach (var configurator in configurators)
         {
             ITelemetryModule telemetryModule = modules.FirstOrDefault((module) => module.GetType() == configurator.TelemetryModuleType);
             if (telemetryModule != null)
             {
                 configurator.Configure(telemetryModule);
             }
         }
     });

            builder.Services.ConfigureTelemetryModule<QuickPulseTelemetryModule>((module, o) => module.QuickPulseServiceEndpoint = "https://quickpulse.applicationinsights.us/QuickPulseService.svc");

            builder.Services.AddSingleton<IApplicationIdProvider>(_ => new ApplicationInsightsApplicationIdProvider() { ProfileQueryEndpoint = "https://dc.applicationinsights.us/api/profiles/{0}/appId" });
            builder.Services.AddSingleton<ITelemetryChannel>(s =>
            {
                // HACK: Need to force the options factory to run somewhere so it'll run through our Configurators.
                var ignore = s.GetService<IOptions<TelemetryConfiguration>>().Value;

                return new ServerTelemetryChannel { EndpointAddress = "https://dc.applicationinsights.us/v2/track" };
            });


        }
    }
}
0reactions
bguidingercommented, Oct 10, 2019

@brettsam let me know if you need help testing this. I’d be happy to help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Application Insights Availability in Azure US Gov Virginia ...
Azure Application Insights is now generally available in US Gov Virginia region. You can see the full list of available regions on the ......
Read more >
Azure AD authentication for Application Insights
Application Insights now supports Azure Active Directory (Azure AD) authentication. ... Azure US Government cloud, https://monitor.azure.us ...
Read more >
The application insights Java 2.X SDK will be retired on 30 ...
On 30 September 2025, we'll be retiring the application insights Java 2.X SDK; after that date it'll no longer be supported.
Read more >
General availability of Azure Application Insights | Azure Blog
We announced the general availability of Azure Application Insights (previously Visual Studio Application Insights) and launched our new ...
Read more >
Application Insights overview - Azure Monitor
Learn how Application Insights in Azure Monitor provides performance management and usage tracking of your live web application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found