Skip to content

Stop requesting Observability API permissions for AI Teammates - #510

Merged
Krishnadheeraj (DheerajPannala) merged 4 commits into
mainfrom
users/DheerajPannala/ai-teammate-skip-observability
Oct 16, 2026
Merged

Krishnadheeraj (DheerajPannala) merged 4 commits into
mainfrom
users/DheerajPannala/ai-teammate-skip-observability

Conversation

@DheerajPannala

@DheerajPannala Krishnadheeraj (DheerajPannala) commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge gate: merge together with microsoft/agent365-skills#86 once the observability service authorizes AI Teammate instances by their blueprint's registration for all tenants. It is validated end to end below; until it is rolled out everywhere, AI Teammates without the OtelWrite role are still rejected.

Summary

a365 setup all no longer requests Observability API (Agent365.Observability.OtelWrite) permissions for AI Teammates, completing what #501 did for blueprint agents. a365 setup permissions bot and a365 create-instance no longer request them for any agent, so no CLI flow asks for Observability admin consent.

This closes two #501 follow-ups: the AI Teammate default, and setup permissions bot still configuring the Observability API.

Why

AI Teammates export telemetry the same way as blueprint agents: an app-only token for the agent identity, sent to the S2S endpoint. AI Teammate instances usually aren't registered themselves, so the service needs to authorize them through their blueprint's registration. Once it does that everywhere, the OtelWrite delegated grant and application role, and the admin consent they need, are unnecessary for AI Teammates too. Requesting them is why AI Teammate setup still shows the "Enable Agent 365 Telemetry" consent and tells non-admins that a Global Administrator must grant the app role.

Probed in a test tenant with an app-only token (no scp, roles=[]) whose parent app is an AI Teammate blueprint:

Agent identity Result today
AI Teammate instance, unregistered, no OtelWrite role 403 insufficient_scope
Registered agent instance, no role (control) 200

With the service change on, the first row now returns 200; see End-to-end validation below.

End-to-end validation

Validated against production with the service-side blueprint authorization turned on for a test tenant. The agent is a deployed AI Teammate instance that has no OtelWrite role or delegated grant, and that is not registered itself (only its blueprint is). It exports with the S2S exporter from microsoft/Agent365-Samples#339 and microsoft/Agent365-nodejs#290.

Token the agent sent (decoded, IDs redacted):

Claim Value
aud Agent 365 Observability API
azp the AI Teammate's agent identity
xms_par_app_azp the AI Teammate blueprint (different from azp)
idtyp app
scp absent
roles []

Requests to /observabilityService/tenants/{tenantId}/otlp/agents/{agentId}/traces:

Service-side blueprint authorization Result
Off 403: the instance itself is not registered
On 200: authorized through the blueprint's registration; 1 invoke_agent span ingested

On the 200 the service also checked that the token's agent identity matched the agent in the URL and in the span payload. No OtelWrite role, delegated scope, or admin consent was involved.

The same token also returned 200 against the pre-production endpoint with the same service setting.

Behavior

  • AI Teammate setup all: no Observability API in inheritable permissions, grants, PowerShell hand-offs, or consent URLs, and the dry run and setup output say so. customBlueprintPermissions can still add the delegated scope back.
  • setup permissions bot: Bot API and Power Platform only. It no longer reports an S2S failure when it has no app role to grant.
  • create-instance: no Observability grant for the agent identity. It still rejects the ambiguous AzureUSGovernment environment before granting anything.
  • Fix, both agent types: a non-admin run whose customBlueprintPermissions adds the Observability API back now includes it in the combined consent URL. Before, the opt-back-in was stamped on the blueprint but left out of the admin hand-off.
  • Re-running setup does not revoke permissions granted earlier.

Upgrade note

The CHANGELOG upgrade note now covers both agent types. Grant the delegated permission only for agents that still export through the delegated route, and the application permission only if app-only exports return 403 insufficient_scope. The guided-setup docs, the setup README, and the design doc match.

Testing

  • Full suite: 2356 passed, 12 skipped (pre-existing), 0 failed. The Release build has 0 warnings.
  • New and updated tests cover the AI Teammate plan and config dry run (Observability omitted), setup permissions bot (no Observability API or app roles, no S2S outcome), create-instance (Power Platform granted, no Observability scopes), the non-admin consent URL with an opted-back-in Observability API, and EnsureUnambiguousEnvironment.

AI Teammates export telemetry with an app-only token through the S2S
endpoint, which can authorize them by their blueprint's registration.
Setup no longer requests Agent365.Observability.OtelWrite for them, and
"setup permissions bot" and "create-instance" no longer request it for
any agent.

A non-admin run whose customBlueprintPermissions adds the Observability
API back now includes it in the combined consent URL.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5b848d24-70d4-4288-a66a-9ca6e1282045
@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

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Oct 14, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5b848d24-70d4-4288-a66a-9ca6e1282045

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

Retained Observability resource-consent state can still cause new instances to receive the permission.

2 open findings
What changed in this PR

Removes default Observability permissions from AI Teammate and instance-creation flows, coordinated with agent365-skills#86 after the service rollout.

Changes:

  • Omits Observability scopes and app roles from setup and instance creation.
  • Preserves custom Observability opt-in and cloud validation.
  • Updates tests, documentation, help text, and release notes.
File Description
A365CreateInstanceRunnerTests.cs Tests omission of Observability grants.
SetupHelpersDisplaySetupSummaryTests.cs Updates summary expectations.
ConfigConstantsTests.cs Tests ambiguous government environments.
SetupCommandTests.cs Updates AI Teammate dry-run tests.
PermissionsSubcommandTests.cs Tests bot permissions without Observability.
AllSubcommandTests.cs Tests custom Observability consent handoff.
A365CreateInstanceRunner.cs Removes default instance Observability scopes.
design.md Updates permission architecture.
ConfigConstants.cs Extracts cloud ambiguity validation.
SetupResults.cs Updates skipped-permission documentation.
SetupHelpers.cs Updates consent and dry-run behavior.
SetupContext.cs Updates Observability context documentation.
SetupSubcommands/​README.md Documents new permission behavior.
PermissionsSubcommand.cs Excludes Observability from bot setup.
AllSubcommand.cs Skips Observability for both agent types.
SetupCommand.cs Updates command help text.
CreateInstanceCommand.cs Removes direct Observability consent.
python-observability.md Updates Python guidance.
nodejs-observability.md Updates Node.js guidance.
dotnet-observability.md Updates .NET guidance.
a365-observability-instructions.md Revises fallback consent instructions.
CHANGELOG.md Adds upgrade and behavior notes.

🧠 Review effort: Balanced


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

@DheerajPannala
Krishnadheeraj (DheerajPannala) marked this pull request as ready for review October 14, 2026 13:18

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.

Main blocker is the guided-setup docs still steering AI Teammates to the delegated route, which this change stops granting by default. Other comments are smaller.

- create-instance skips Observability entries saved in resourceConsents by
  earlier setups unless customBlueprintPermissions opts back in, with a
  regression test for both cases.
- Guided-setup observability doc points AI Teammates at the app-only S2S
  exporter and marks the hosting-package token cache as a legacy delegated
  route that needs the delegated OtelWrite grant added manually.
- AI Teammate dry run says when customBlueprintPermissions requests the
  Observability API.
- setup permissions bot drops the unreachable S2S failure branch; tests drop
  the unused s2sSucceeds parameter.
- Clarify SkipObservabilityPermissions and fix design.md tree indentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5b848d24-70d4-4288-a66a-9ca6e1282045

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.

🔵 Needs a closer look

The service rollout and coordinated merge require human confirmation, and the custom-permission parsing issue remains unresolved.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

Setup reads config keys case-insensitively, so a mixed-case Observability
opt-in was honored by setup but ignored by create-instance.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5b848d24-70d4-4288-a66a-9ca6e1282045
Copilot AI balanced review requested due to automatic review settings October 16, 2026 11:21

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.

🔵 Needs a closer look

A case-sensitive configuration lookup still skips valid explicit Observability opt-ins during instance creation.

0 open findings

1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Make top-level permission lookup case-insensitive

src/​Microsoft.Agents.A365.DevTools.Cli/​Services/​A365CreateInstanceRunner.cs:1045

The top-level lookup remains case-sensitive; the serializer options only apply to keys inside the array. A config with CustomBlueprintPermissions is accepted by ConfigService.LoadAsync (ConfigService.cs:102,151), but returns false here. With a saved Observability consent, instance creation therefore skips the explicitly requested delegated grant. Match the outer key case-insensitively too, and extend the opt-in regression test to cover a PascalCase top-level key.

🧠 Review effort: Balanced

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.

Thanks, all comments addressed.

@DheerajPannala
Krishnadheeraj (DheerajPannala) merged commit f0849e0 into main Oct 16, 2026
10 checks passed
@DheerajPannala
Krishnadheeraj (DheerajPannala) deleted the users/DheerajPannala/ai-teammate-skip-observability branch October 16, 2026 15:39
Rick Brighenti (rbrighenti) added a commit that referenced this pull request Oct 20, 2026
- Restore Added entries orphaned under Breaking Changes by #385 and merge duplicate Changed/Fixed/Removed sections.
- Add missing entry for the develop-mcp publish error-message fix (#503).
- Drop stale entries for setup admin (removed in #393), create-instance re-enable (removed again in #397), and OtelWrite granted to all identities (superseded by #501/#510); add a Removed entry for setup admin.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

5 participants