diff --git a/src/common/appInsightsClientFactory.ts b/src/common/appInsightsClientFactory.ts index 8b7f5e8..cb9cd71 100644 --- a/src/common/appInsightsClientFactory.ts +++ b/src/common/appInsightsClientFactory.ts @@ -25,8 +25,15 @@ export const appInsightsClientFactory = async (connectionString: string, machine extensionConfig[BreezeChannelIdentifier] = channelConfig; } + let instrumentationKey: string | undefined; + if (!connectionString.startsWith("InstrumentationKey=")) { + instrumentationKey = connectionString; + } + + const authConfig = instrumentationKey ? { instrumentationKey } : { connectionString }; + appInsightsClient = new basicAISDK.ApplicationInsights({ - connectionString: connectionString, + ...authConfig, disableAjaxTracking: true, disableExceptionTracking: true, disableFetchTracking: true,