Skip to content

Add --skip-observability-permissions to setup all - #501

Open
Krishnadheeraj (DheerajPannala) wants to merge 1 commit into
mainfrom
users/DheerajPannala/skip-observability-permissions
Open

Krishnadheeraj (DheerajPannala) wants to merge 1 commit into
mainfrom
users/DheerajPannala/skip-observability-permissions

Conversation

@DheerajPannala

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in a365 setup all --skip-observability-permissions for blueprint agents that export telemetry through the app-only S2S endpoint, and fixes setup all --agent-registration-only exiting 0 when registration fails.

Why

With microsoft/Agent365-nodejs#290 and microsoft/Agent365-Samples#339, agents export telemetry with an app-only token to the S2S endpoint (/observabilityService/tenants/{tenantId}/otlp/agents/{agentId}/traces). That endpoint authorizes registered agent instances without the Agent365.Observability.OtelWrite role: an end-to-end run with a roleless app-only token from a DevTools-registered agent returned HTTP 200 and the spans arrived. Today setup all always requests OtelWrite as both a delegated scope and an app role, and both need admin consent. This flag lets those agents skip them.

Defaults are unchanged, because the published SDKs still export to the non-S2S endpoint by default, and that endpoint does need OtelWrite.

Changes

  • --skip-observability-permissions removes Observability API from:
    • the permission specs (inheritable permissions, app role grants, batch consent);
    • the per-resource and combined admin consent URLs;
    • the dry-run plan and the summary's portal walkthrough.
  • The flag fails fast (exit 1) for AI Teammate agents. It also fails with authMode s2s/both, whether set by flag or in a365.config.json, because OtelWrite is the only app role those modes grant. A contradicting --authmode flag is rejected before bootstrap signs in or writes config.
  • With the flag, a failed agent registration is recorded as an error (exit 1), because registration is then the agent's only Observability authorization.
  • Fix: --agent-registration-only now exits 1 when registration fails. The summary already pointed to "see errors", but the failure was recorded as a warning.
  • Updated the CHANGELOG, Commands/SetupSubcommands/README.md, and the guided-setup observability doc.

The flag does not revoke permissions granted by earlier runs. Stale-permission cleanup already protects Observability API.

Testing

  • 15 new test cases cover spec and consent-URL wiring, validation and fail-fast order, registration severity, the dry run, and the summary. Each was confirmed to fail against a mutation of the code it guards.
  • Full suite: 2027 passed, 12 skipped (pre-existing), 0 failed. The Release build has 0 warnings, and restore ran with NuGet audit enabled.
  • I packed and installed the CLI (1.1.223+bacea97843), then checked setup all --help, the dry run, and the rejected combinations. The rejected combinations write no files.
  • Not run live: a full setup all --skip-observability-permissions against a tenant, because it creates Entra objects. Roleless S2S access was verified on the /otlp route above; the legacy S2S route and sovereign clouds were not verified.

Out of scope / follow-ups

  • AI Teammate setup (create-instance) still grants OtelWrite.
  • a365 setup permissions bot still configures Observability API.
  • Consider making the skip the default once the SDKs default to the S2S endpoint.

Blueprint agents that export telemetry through the app-only S2S endpoint
(microsoft/Agent365-nodejs#290, microsoft/Agent365-Samples#339) are
authorized by their agent registration, so the Observability API OtelWrite
permission, and the admin consent it needs, is unnecessary for them.

- New opt-in `setup all --skip-observability-permissions` omits Observability
  API from the permission specs (inheritable permissions, app role grants,
  batch consent) and from the per-resource and combined admin consent URLs.
  Defaults are unchanged: the published SDKs still export to the non-S2S
  endpoint by default.
- The flag fails fast for AI Teammate agents and with authMode s2s/both,
  since OtelWrite is the only app role those modes grant. A contradicting
  --authmode flag is rejected before bootstrap signs in.
- With the flag, a failed agent registration is an error (exit 1), because
  registration is then the agent's only Observability authorization.
- Fix: `setup all --agent-registration-only` exited 0 when registration failed.
- Dry run plan, setup summary, CHANGELOG, and docs updated.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 5cbf5f6b-cc40-4b7e-a591-65848db73a12
Copilot AI lite review requested due to automatic review settings September 23, 2026 11:45
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 23, 2026
@github-actions

Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

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.

Copilot review overview

🔵 Needs a closer look

Unresolved validation, failure-handling, persisted-consent, custom-permission, and route-documentation issues remain.

Review effort: Lite
Findings: None

What changed in this PR

Adds --skip-observability-permissions for blueprint setup and fixes registration-only failure handling.

Changes:

  • Adds permission, consent, validation, dry-run, and summary handling.
  • Updates registration failure severity and related tests.
  • Updates documentation and changelog.
File Description
src/​Tests/​Microsoft.Agents.A365.DevTools.Cli.Tests/​Helpers/​SetupHelpersDisplaySetupSummaryTests.cs Tests summary behavior.
src/​Tests/​Microsoft.Agents.A365.DevTools.Cli.Tests/​Commands/​SetupSubcommands/​PermissionSpecsTests.cs Tests permission specifications.
src/​Tests/​Microsoft.Agents.A365.DevTools.Cli.Tests/​Commands/​SetupCommandTests.cs Tests validation and dry-run behavior.
src/​Tests/​Microsoft.Agents.A365.DevTools.Cli.Tests/​Commands/​NonDwBlueprintSetupOrchestratorExecuteTests.cs Tests registration failure handling.
src/​Tests/​Microsoft.Agents.A365.DevTools.Cli.Tests/​Commands/​AllSubcommandTests.cs Tests permission and consent wiring.
src/​Microsoft.Agents.A365.DevTools.Cli/​Commands/​SetupSubcommands/​SetupResults.cs Tracks skipped permissions.
src/​Microsoft.Agents.A365.DevTools.Cli/​Commands/​SetupSubcommands/​SetupHelpers.cs Handles permissions and consent URLs.
src/​Microsoft.Agents.A365.DevTools.Cli/​Commands/​SetupSubcommands/​SetupContext.cs Stores setup options.
src/​Microsoft.Agents.A365.DevTools.Cli/​Commands/​SetupSubcommands/​README.md Documents the option.
src/​Microsoft.Agents.A365.DevTools.Cli/​Commands/​SetupSubcommands/​NonDwBlueprintSetupOrchestrator.cs Applies skip behavior and failure handling.
src/​Microsoft.Agents.A365.DevTools.Cli/​Commands/​SetupSubcommands/​AllSubcommand.cs Adds and validates the CLI option.
docs/​agent365-guided-setup/​a365-observability-instructions.md Updates observability guidance.
CHANGELOG.md Records the feature and fix.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Requesting changes. The flag is well scoped and the incompatible-combination guards look right, but two gaps undercut the contract the docs promise ("setup exits with code 1 if registration fails"). Details inline. Both need a regression test.


// Registration is the sole purpose of --agent-registration-only and, with OtelWrite skipped,
// the agent's only Observability authorization, so its failure must fail setup.
var registrationRequired = skipIdentityAndPermissions || ctx.SkipObservabilityPermissions;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

registrationRequired covers the create-failure path, but the inconclusive-verification branch below (AgentRegistrationExistsAsync returns null, "retaining stored value") still sets registrationAlreadyExisted = true and setup exits 0. With --skip-observability-permissions registration is the agent's only authorization, so an auth or transient failure there should be an error rather than a pass. Please treat the null case as an error when registrationRequired is true, and add a test where the check returns null.


var consentResourceNames = PopulateAdminConsentUrls(ctx.Config, mcpResourceAppId, mcpScopes, isM365, mcpScopesByAudience, mcpAudienceDisplayNames);
var includeObservability = !ctx.SkipObservabilityPermissions;
var consentResourceNames = PopulateAdminConsentUrls(ctx.Config, mcpResourceAppId, mcpScopes, isM365, mcpScopesByAudience, mcpAudienceDisplayNames, includeObservability);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PopulateAdminConsentUrls only upserts into ResourceConsents, so if an earlier run without the flag saved an Observability consent entry, it survives this run and is still surfaced to the admin. When includeObservability is false the Observability entry should be removed. A test that seeds the generated config with an existing Observability consent would cover it.

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants