Skip to content

[monitor-trace-association] Add preview extension for Microsoft.Monitor/traceAssociations (draft) - #10167

Draft
bragi92 wants to merge 3 commits into
Azure:mainfrom
bragi92:monitor-trace-association
Draft

bragi92 wants to merge 3 commits into
Azure:mainfrom
bragi92:monitor-trace-association

Conversation

@bragi92

@bragi92 bragi92 commented Jul 31, 2026

Copy link
Copy Markdown
Member

Draft — do not merge (blocked on public REST API spec)

Adds a new preview extension monitor-trace-association for Microsoft.Monitor/traceAssociations (API version 2026-01-01-preview).

az monitor trace-association maps a scope (Application Insights component, resource group, or subscription) to an Azure Monitor Workspace for trace routing. Singleton default; multi-homing via scope inheritance.

Commands

  • create — PUT (CreateOrUpdate)
  • update — GET + merge + PUT
  • show — GET
  • delete — DELETE
  • list — GET (ListByScope)

Args: --resource-uri/--scope (required), --azure-monitor-workspace-resource-id/--amw-id (required on create), --name/-n (default default).

Status / why this is a draft

  • The spec is currently only in the private azure-rest-api-specs-pr (PR #27737); it is not yet in public Azure/azure-rest-api-specs. A 120-day ARM lease is holding the API version (expires ~Sept 2026).
  • Command bodies are a functional prototype calling ARM directly via send_raw_request. They will be replaced by aaz-dev-generated code (with the matching Azure/aaz command-model PR) once the swagger is published publicly.
  • Marked isPreview: true.

Validation done locally

  • python -m py_compile passes for all modules.
  • Built the wheel, az extension add, and verified -h for the group and every command: command tree, required args, defaults, and examples all render.

TODO before ready-for-review

  • Public azure-rest-api-specs PR merged (port from -pr #27737).
  • Regenerate via aaz-dev from the public swagger; open the Azure/aaz command-model PR.
  • Replace the direct-ARM prototype with generated aaz/ code.
  • Add recorded scenario test.

Co-authored with GitHub Copilot CLI.

…or/traceAssociations (draft)

Adds `az monitor trace-association` create/update/show/delete/list for
Microsoft.Monitor/traceAssociations, API version 2026-01-01-preview.

DRAFT: command bodies call ARM directly (send_raw_request) as a functional
prototype; to be replaced by aaz-dev-generated code once the spec is published
to the public Azure/azure-rest-api-specs repo (currently only in
azure-rest-api-specs-pr #27737). Do not merge until the public spec lands.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: fe50b7ed-a3b8-4f18-85e2-a20194432da9
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

…n update

The azdev linter rule no_parameter_defaults_for_update_commands (HIGH) failed
because 'name' was registered with default='default' in the shared
'monitor trace-association' argument context, which propagated to the update
command.

Drop the explicit default from the shared context and let each command supply
its own default via its function signature. update_trace_association now takes
name=None and resolves the singleton name internally, so behaviour is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 534f4033-4217-4c50-880f-9b8c44d46964
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

…e, list

The azdev linter rule missing_command_example (HIGH) requires every modified
command to carry at least one example. Only 'create' had one.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 534f4033-4217-4c50-880f-9b8c44d46964
@a0x1ab

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@x-engineering-agent

Copy link
Copy Markdown

Live test results — azdev test --live --series (changed test files only)

⚠️ NO TESTS SELECTED — changed test files did not resolve to runnable tests

Selectors: test_monitor_trace_association (extension)
PR head ref: monitor-trace-association
PR head sha: bea8bf27fbfd0a0d6d4d3cd7638a586654b036cb
PR base ref: main
New test files in PR: true

Changed test files run
src/monitor-trace-association/azext_monitor_trace_association/tests/latest/test_monitor_trace_association.py

New test files
src/monitor-trace-association/azext_monitor_trace_association/tests/latest/test_monitor_trace_association.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32347009155

Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13705: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'
ERROR: 'test_monitor_trace_association' exists twice in the 'azext_monitor_trace_association' module. Please rename one or both and re-run --discover. Duplication exists in: 
	/home/runner/work/issue-sentinel/issue-sentinel/azure-cli-extensions/src/monitor-trace-association/azext_monitor_trace_association/tests/latest/test_monitor_trace_association.py::MonitorTraceAssociationScenario::test_monitor_trace_association
	/home/runner/work/issue-sentinel/issue-sentinel/azure-cli-extensions/src/monitor-trace-association/azext_monitor_trace_association/tests/latest/test_monitor_trace_association.py


test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_monitor_trace_association

WARNING: RUNNING TESTS LIVE
WARNING: 'test_monitor_trace_association' not found. If newly added, re-run with --discover
WARNING: No tests selected to run.

Posted by agent-assist live-test workflow.

@x-engineering-agent x-engineering-agent Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Automated Review Summary — PR #10167

CI status: All 28 completed CI checks passed (0 failed, 0 pending).

Live test (Tester): ❌ Failed — azdev test exit code 2 for the changed test file:
src/monitor-trace-association/azext_monitor_trace_association/tests/latest/test_monitor_trace_association.py

The test run did not execute (RAN_TESTS=false), which indicates a collection/setup
error rather than an assertion failure — likely a missing recording, import error, or
fixture issue for this brand-new test file. See the workflow run for details:
https://github.com/Azure/issue-sentinel/actions/runs/32347009155

A detailed run comment (with the last 80 lines of azdev output) was already posted to
this PR by the live-test workflow. Please review that output and address the failure.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants