From d74c6bfb7bc2ff84ae15cceeba2fb7dc5c3ccd17 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Thu, 14 Oct 2021 15:12:37 -0700 Subject: [PATCH] Configure ApplicationInsights to not send cloud role name (#16246) Configure ApplicationInsights to not send cloud role name Co-authored-by: Aditya Patwardhan --- src/System.Management.Automation/utils/Telemetry.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/System.Management.Automation/utils/Telemetry.cs b/src/System.Management.Automation/utils/Telemetry.cs index 0ebdfc06e1..105feef73e 100644 --- a/src/System.Management.Automation/utils/Telemetry.cs +++ b/src/System.Management.Automation/utils/Telemetry.cs @@ -10,6 +10,7 @@ using System.Threading; using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.Extensibility; +using Microsoft.ApplicationInsights.Extensibility.Implementation; namespace Microsoft.PowerShell.Telemetry { @@ -118,6 +119,9 @@ namespace Microsoft.PowerShell.Telemetry configuration.TelemetryChannel.DeveloperMode = false; s_telemetryClient = new TelemetryClient(configuration); + // Be sure to obscure any information about the client node. + s_telemetryClient.Context.Cloud.RoleInstance = string.Empty; + s_telemetryClient.Context.GetInternalContext().NodeName = string.Empty; s_sessionId = Guid.NewGuid().ToString(); // use a hashset when looking for module names, it should be quicker than a string comparison