ApplicationInsights-node.js icon indicating copy to clipboard operation
ApplicationInsights-node.js copied to clipboard

Local Auth Disabled Issues

Open PrestonGiorgianni opened this issue 6 months ago • 0 comments

Issue

I am using [email protected] in my nodejs application. When I went to disable local authentication I stopped getting telemetry even when supplying the credential. I have tried adding Monitoring Metrics Publisher, Log Analytics Contributor and just Contributor to the user with no change.

Is this still supported in the 3.X SDK?

Code

const appInsights = require('applicationinsights');
const {DefaultAzureCredential} = require('@azure/identity');

appInsights
		.setup()
		.setInternalLogging(true, true)
		.setAutoCollectRequests(true)
		.setAutoCollectPerformance(true, true)
		.setAutoCollectExceptions(true)
		.setAutoCollectDependencies(true)
		.setAutoCollectConsole(true)
		.setSendLiveMetrics(true)
		.start();
		
const credential = new DefaultAzureCredential();
let client = appInsights.defaultClient;

client.config.aadTokenCredential = credential;
client.trackEvent({name: "my custom event", properties: {customProperty: "custom property value"}});
client.trackException({exception: new Error("handled exceptions can be logged with this method")});
client.trackMetric({name: "customMetric", value: 3});
client.trackTrace({message: "trace message"});
client.trackDependency({target:"http://dbname", name:"select customers proc", data:"SELECT * FROM Customers", duration:231, resultCode:0, success: true, dependencyTypeName: "ZSQL"});
client.trackRequest({name:"GET /customers", url:"http://myserver/customers", duration:309, resultCode:'200', success:true});
client.flush();

PrestonGiorgianni avatar Jun 24 '25 23:06 PrestonGiorgianni