Skip to content

Fix blueprint setup consent flow and role accuracy (#403)#405

Open
sellakumaran wants to merge 2 commits intomainfrom
users/sellak/issue-403-fixes
Open

Fix blueprint setup consent flow and role accuracy (#403)#405
sellakumaran wants to merge 2 commits intomainfrom
users/sellak/issue-403-fixes

Conversation

@sellakumaran
Copy link
Copy Markdown
Contributor

  • DelegatedConsentService: return false on 4xx PATCH failures instead of silently returning true; check return value in caller and surface an actionable error with a v2.0/adminconsent URL when a non-admin cannot update an existing permission grant
  • SetupHelpers: fix pendingAdminAction regression (commit 650ebdb) that hid the consent URL for DW agents when S2S grants were also pending
  • SetupHelpers: replace removed Maven.ReadWrite.All scope with ObservabilityApiOtelWriteScope in consent URLs
  • AuthenticationConstants: correct S2SGrantRequiredRoles — Agent ID Administrator cannot create S2S app role assignments (verified by live testing); role list now matches DelegatedGrantRequiredRoles
  • CleanupCommand: surface actionable error message when cleanup is run without --agent-name and no config file is present

- DelegatedConsentService: return false on 4xx PATCH failures instead of
  silently returning true; check return value in caller and surface an
  actionable error with a v2.0/adminconsent URL when a non-admin cannot
  update an existing permission grant
- SetupHelpers: fix pendingAdminAction regression (commit 650ebdb) that
  hid the consent URL for DW agents when S2S grants were also pending
- SetupHelpers: replace removed Maven.ReadWrite.All scope with
  ObservabilityApiOtelWriteScope in consent URLs
- AuthenticationConstants: correct S2SGrantRequiredRoles — Agent ID
  Administrator cannot create S2S app role assignments (verified by live
  testing); role list now matches DelegatedGrantRequiredRoles
- CleanupCommand: surface actionable error message when cleanup is run
  without --agent-name and no config file is present

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 5, 2026 23:26
@sellakumaran sellakumaran requested review from a team as code owners May 5, 2026 23:26
@github-actions github-actions Bot added the bug Something isn't working label May 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

⚠️ 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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens setup and cleanup handoff flows in the Agent365 CLI by correcting consent/role guidance and improving how setup surfaces manual admin follow-up when automatic permission changes fail.

Changes:

  • Updated delegated-consent handling to surface a manual admin-consent path when patching an existing grant fails.
  • Fixed setup summary/admin-consent URL generation for DW flows and switched Observability consent URLs to the OtelWrite scope.
  • Corrected S2S required-role messaging and improved cleanup behavior when no config file is present.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Tests/Microsoft.Agents.A365.DevTools.Cli.Tests/Helpers/SetupHelpersConsentUrlTests.cs Updated consent URL assertions for the Observability scope.
src/Microsoft.Agents.A365.DevTools.Cli/Services/DelegatedConsentService.cs Changed existing-grant update behavior and added manual admin-consent fallback logging.
src/Microsoft.Agents.A365.DevTools.Cli/Constants/ConfigConstants.cs Removed the old Observability admin-consent scope constant and repointed comments to OtelWrite.
src/Microsoft.Agents.A365.DevTools.Cli/Constants/AuthenticationConstants.cs Narrowed the documented S2S roles to Application Admin / Global Admin.
src/Microsoft.Agents.A365.DevTools.Cli/Commands/SetupSubcommands/SetupHelpers.cs Adjusted setup-summary pending-action logic and consent URL construction for Observability.
src/Microsoft.Agents.A365.DevTools.Cli/Commands/CleanupCommand.cs Replaced the missing-config cleanup error with a more direct --agent-name instruction.

Comment thread src/Microsoft.Agents.A365.DevTools.Cli/Services/DelegatedConsentService.cs Outdated
Comment thread src/Microsoft.Agents.A365.DevTools.Cli/Services/DelegatedConsentService.cs Outdated
…fixes

- Remove PublishBlueprintNonDwAsync: a365 publish was silently calling
  POST /beta/agentRegistry/agentInstances (old v1 API, no idempotency)
  for blueprint non-DW agents. Registration belongs in setup all, which
  already uses the correct copilot/agentRegistrations v2 endpoint.
  Blueprint path now directs users to a365 setup all.
- Fix redirect_uri in DelegatedConsentService fallback consent URL:
  BlueprintConsentRedirectUri is not registered on customer client apps,
  causing AADSTS500113. Omit redirect_uri so the URL works for any app.
- Fix 5xx treated as success in EnsureScopeOnGrantAsync: transient PATCH
  failures now return false so the caller surfaces an actionable error
  rather than silently reporting consent as granted.
- Add regression tests for DW pendingAdminAction: consent URL must appear
  in Action Required when admin consent is pending on the DW path, including
  when S2S grants are also pending.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants