Skip to content

{Telemetry} Bypass telemetry filtering rules on debug dev/debug builds - #1492

Open
JaysonTaiMicrosoft wants to merge 10 commits into
Azure:mainfrom
JaysonTaiMicrosoft:jaysontaimicrosoft-local-telemetry-rule-bypass
Open

JaysonTaiMicrosoft wants to merge 10 commits into
Azure:mainfrom
JaysonTaiMicrosoft:jaysontaimicrosoft-local-telemetry-rule-bypass

Conversation

@JaysonTaiMicrosoft

@JaysonTaiMicrosoft JaysonTaiMicrosoft commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Related command

Description

Add local dev feature requested in [Dev] Bypass telemetry tag rules when AZCLIPS_TELEMETRY_TARGET=local #1353

  1. ONLY debug builds honor the AZCLIPS_TELEMETRY_TARGET variable.
  2. When set to local unfiltered all telemetry information becomes unfiltered e.g urls, error descriptions and parameters become visible in local Jaeger telemetry.
  3. When set to both, local AND remote telemetry exported is FILTERED.
  4. When set to remote, telemetry is only sent to remote sinks. Therefore, all data is filtered.
  5. Release builds ignore AZCLIPS_TELEMETRY_TARGET variable completely and only export to remote sinks with all data filtered.

Testing Guide

From Powershell terminal

DEBUG Default or $env:AZCLIPS_TELEMETRY_TARGET = 'both'(expect data in Jaeger and bronze clusters to be filtered)

  1. ./artifacts/debug/Core.Cli/az.exe group show --name <non-existent>

DEBUG $env:AZCLIPS_TELEMETRY_TARGET = 'local' (expect data in Jaeger only and UNFILTERED)

  1. ./artifacts/debug/Core.Cli/az.exe group show --name <non-existent>

DEBUG $env:AZCLIPS_TELEMETRY_TARGET = 'remote' (expect data in bronze cluster only and filtered)

  1. ./artifacts/debug/Core.Cli/az.exe group show --name <non-existent>

RELEASE

$env:AZCLIPS_TELEMETRY_TARGET = 'both', $env:AZCLIPS_TELEMETRY_TARGET = 'local', $env:AZCLIPS_TELEMETRY_TARGET = 'remote' (expect data in bronze cluster only and filtered)

  1. ./artifacts/Release/Core.Cli/az.exe group show --name <non-existent>

Note: May take 10-15 minutes for data to appear in bronze cluster.

PowerShell cmdlets

Set the target first, then import the modules and run the cmdlet (use a fresh PowerShell session for each target).

DEBUG Default or $env:AZCLIPS_TELEMETRY_TARGET = 'both' (expect data in Jaeger and bronze clusters to be filtered)

  1. Import-Module ./src/PS/Accounts/Accounts.psd1; Import-Module ./src/PS/Resources/Resources.psd1; Import-Module ./src/PS/Compute/Compute.psd1
  2. Get-AzResourceGroup

DEBUG $env:AZCLIPS_TELEMETRY_TARGET = 'local' (expect data in Jaeger only and UNFILTERED)

  1. Import-Module ./src/PS/Accounts/Accounts.psd1; Import-Module ./src/PS/Resources/Resources.psd1; Import-Module ./src/PS/Compute/Compute.psd1
  2. Get-AzResourceGroup

DEBUG $env:AZCLIPS_TELEMETRY_TARGET = 'remote' (expect data in bronze cluster only and filtered)

  1. Import-Module ./src/PS/Accounts/Accounts.psd1; Import-Module ./src/PS/Resources/Resources.psd1; Import-Module ./src/PS/Compute/Compute.psd1
  2. Get-AzResourceGroup

RELEASE

$env:AZCLIPS_TELEMETRY_TARGET = 'both', $env:AZCLIPS_TELEMETRY_TARGET = 'local', $env:AZCLIPS_TELEMETRY_TARGET = 'remote' (expect data in bronze cluster only and filtered)

  1. Stage the modules with build/Set-ModuleConfiguration.ps1 -Configuration Release, then import the staged Accounts, Resources and Compute modules
  2. Get-AzResourceGroup

History Notes


  • The PR title starts with [Component Name] for customer-facing changes or {Component Name} for non-customer-facing changes, and does not end with trailing punctuation or spaces.
  • Customer-facing changes include a useful release note in the PR title or the History Notes section.
  • I added or updated tests for behavior changes.
  • I updated documentation when behavior, setup, support, or security guidance changed.

@JaysonTaiMicrosoft JaysonTaiMicrosoft self-assigned this Nov 19, 2026
@JaysonTaiMicrosoft
JaysonTaiMicrosoft marked this pull request as ready for review November 19, 2026 02:48
@JaysonTaiMicrosoft
JaysonTaiMicrosoft requested a review from a team as a code owner November 19, 2026 02:48
Copilot AI balanced review requested due to automatic review settings November 19, 2026 02:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unfiltered telemetry can expose plaintext passwords through an unauthenticated collector UI bound to all interfaces and local files lacking owner-only permissions.

3 open issues
What changed in this PR

Adds unfiltered local telemetry for Debug builds, addressing #1353 while keeping remote exports and Release builds filtered.

Changes:

  • Resolves telemetry targets once per process and bypasses privacy filters only in Debug local-only mode.
  • Separates local traces into traces-local, preserving raw parameters, tags, events and status descriptions.
  • Adds targeted tests and documents local-mode behavior, isolation and sensitive-data risks.
File Description
wiki/​02-deep-dive/​telemetry.md Explains filter bypass and local queue isolation.
wiki/​01-getting-started/​overview.md Adds the local trace directory reference.
wiki/​01-getting-started/​environment-setup.md Updates a source-line reference.
wiki/​01-getting-started/​cli-usage.md Updates a source-line reference.
tools/​observability/​README.md Documents local-mode risks and verification steps.
tests/​Shared/​TelemetryTargetIsolation.cs Clears inherited telemetry targets before tests.
tests/​Directory.Build.props Includes shared test isolation code.
tests/​Core.Telemetry.Tests/​TraceReplayerTests.cs Tests status-description replay.
tests/​Core.Telemetry.Tests/​TelemetryTargetResolverTests.cs Tests bypass eligibility and cached resolution.
tests/​Core.Telemetry.Tests/​TelemetryServiceParameterFormattingTests.cs Tests masked and revealed parameter formatting.
tests/​Core.Telemetry.Tests/​TelemetryServiceEnabledGateTests.cs Verifies invocation parameters remain masked normally.
tests/​Core.Telemetry.Tests/​TelemetrySenderRegistrationTests.cs Tests conditional filter registration.
tests/​Core.Telemetry.Tests/​PersistenceTelemetryTests.cs Tests local and shared queue isolation.
tests/​Core.Telemetry.Tests/​HttpActivityEnricherTests.cs Tests conditional exception sanitization.
tests/​Core.Telemetry.Tests/​FileExporterBatchTests.cs Tests unfiltered trace serialization.
src/​Core/​Core.Telemetry/​TraceReplayer.cs Restores recorded status descriptions.
src/​Core/​Core.Telemetry/​TraceEntry.cs Adds optional status-description storage.
src/​Core/​Core.Telemetry/​TelemetryUploadReservation.cs Routes reservations to the selected queue.
src/​Core/​Core.Telemetry/​TelemetryUpload.cs Selects the matching upload queue.
src/​Core/​Core.Telemetry/​TelemetryTargetResolver.cs Caches targets and derives bypass and queue selection.
src/​Core/​Core.Telemetry/​TelemetryService.cs Reveals parameter values in local-only mode.
src/​Core/​Core.Telemetry/​ITraceDirectoryProvider.cs Selects shared or local trace storage.
src/​Core/​Core.Telemetry/​HttpActivityEnricher.cs Preserves HTTP exception text when bypassing rules.
src/​Core/​Core.Telemetry/​FileTelemetrySender.cs Passes bypass mode to the file exporter.
src/​Core/​Core.Telemetry/​FileExporter.cs Retains raw tags, events and status descriptions locally.
src/​Core/​Core.Telemetry/​DIRegisterExtensions.cs Omits filter processors when bypassing rules.
src/​Core/​Core.Abstractions/​HomePaths.cs Defines the local trace directory name.
eng-docs/​spec/​telemetry.md Documents the local-mode privacy exception and queue.

Review effort: Balanced

Comment thread src/Core/Core.Telemetry/FileExporter.cs Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants