ApplicationInsights-JS icon indicating copy to clipboard operation
ApplicationInsights-JS copied to clipboard

How to log with Monitoring Metrics Publisher role

Open Sujay-shetty opened this issue 6 months ago • 5 comments

Description/Screenshot We are using Application insights to log from frontend and application insights is associated to resource group with Monitoring Metrics Publisher role assigned. Which requires an authentication to be called.

But from frontend we can only pass connection string property.

How to achieve application insights logging with Monitoring Metrics Publisher role assigned?

While searching I found suggestions to incorporate proxy server but is it the cleaner approach? https://learn.microsoft.com/en-us/answers/questions/2280070/application-insights-javascript-sdk-401-unauthoriz Steps to Reproduce

  • OS/Browser: Any
  • SDK Version [e.g. 22]: latest (3.3.8)
  • How you initialized the SDK:

import { ApplicationInsights} from "@microsoft/applicationinsights-web";

const appInsights = new ApplicationInsights({ config: { connectionString: CONNECTION_STRING' } }); appInsights.loadAppInsights();

Expected behavior With Monitoring Metrics Publisher role application insights allowed to log

Sujay-shetty avatar Jun 10 '25 12:06 Sujay-shetty

@MSNev any help on above request?

Sujay-shetty avatar Jun 13 '25 04:06 Sujay-shetty

Nev is currently OOF. Based on https://azure.microsoft.com/en-us/updates?id=switch-to-azure-ad-authentication-for-application-insights-by-30-september-2025 and https://learn.microsoft.com/en-us/azure/azure-monitor/app/azure-ad-authentication?tabs=aspnetcore#unsupported-scenarios it seems that the proxy is the most straightforward way for the browser side currently

Karlie-777 avatar Jun 16 '25 22:06 Karlie-777

Well I'm back, another option (which is currently being documented by one of our Support people -- not ready yet) is to create and use an Azure APIM as the proxy (so you don't need to create your own) so you can "add" the authentication within the APIM configuration

MSNev avatar Jul 01 '25 23:07 MSNev

thank you for the suggestions @MSNev , when will the official documentation will be available? or may be certain steps will help in proceeding on this?

Sujay-shetty avatar Jul 25 '25 04:07 Sujay-shetty