Skip to content

Enable portal-only admin consent for bulk onboarding - #502

Merged
Walter Luna (walterluna) merged 4 commits into
microsoft:mainfrom
walterluna:update-bulk-onboarding-app-creation
Oct 1, 2026
Merged

Walter Luna (walterluna) merged 4 commits into
microsoft:mainfrom
walterluna:update-bulk-onboarding-app-creation

Conversation

@walterluna

Copy link
Copy Markdown
Contributor

Declare application roles and delegated scopes with -SkipGrant so administrators can grant consent in Entra without running the script.

  • Preserve existing API permissions and avoid duplicate declarations
  • Report declared permissions, consent failures, and portal links
  • Add regression coverage for permission merging and idempotency

Declare application roles and delegated scopes with -SkipGrant so
administrators can grant consent in Entra without running the script.

- Preserve existing API permissions and avoid duplicate declarations
- Report declared permissions, consent failures, and portal links
- Add regression coverage for permission merging and idempotency
Copilot AI lite review requested due to automatic review settings September 23, 2026 15:29

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

🟡 Changes recommended

Resolve merge conflicts and add execution-level coverage for skip-grant behavior.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Enables portal-only admin consent for bulk onboarding by declaring permissions and reporting Entra consent links.

Changes:

  • Adds permission merging and idempotency handling.
  • Adds -SkipGrant behavior and consent reporting.
  • Adds regression coverage for permission declarations.
File Summary
scripts/​bulk-agent-registration/​New-A365AutomationApp.ps1 Implements permission declaration and consent reporting; unresolved merge conflicts prevent parsing.
scripts/​bulk-agent-registration/​tests/​PermissionDeclaration.Tests.ps1 Tests permission merging, but lacks execution-level coverage for -SkipGrant behavior.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/bulk-agent-registration/New-A365AutomationApp.ps1 Outdated
Copilot AI review requested due to automatic review settings September 23, 2026 15:41

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

🟡 Changes recommended

Unresolved issues remain in WhatIf reporting, duplicate reconciliation, and consent-status accuracy.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity · 1 Low severity

Open (3)
Resolved since last review (1)

Comment thread scripts/bulk-agent-registration/New-A365AutomationApp.ps1 Outdated
Comment thread scripts/bulk-agent-registration/New-A365AutomationApp.ps1 Outdated
Comment thread scripts/bulk-agent-registration/New-A365AutomationApp.ps1 Outdated
Copilot AI review requested due to automatic review settings September 25, 2026 10:27

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

🟡 Changes recommended

Resolve partial permission reporting and add the required release note; test organization also needs improvement.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
Resolved since last review (3)

Comment thread scripts/bulk-agent-registration/New-A365AutomationApp.ps1
Comment thread scripts/bulk-agent-registration/readme.md
Comment thread scripts/bulk-agent-registration/New-A365AutomationApp.ps1 Outdated

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

🟡 Changes recommended

The user-facing change lacks a changelog entry, and the oversized test suite should be split.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (2)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 744dc687-79b1-4181-a626-57d46d06260f

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 permissions can be reported as complete, and the generated consent link can fail for newly created apps.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Previously missed (3)

In code that hasn't changed since last review

Medium severity Confirmation uses unrelated default app display name

scripts/​bulk-agent-registration/​New-A365AutomationApp.ps1:1232

When an existing app is selected with -AppId, $DisplayName can still be the unrelated default value, even though the fetched application has its real display name. The confirmation can therefore ask the operator to approve a permissions PATCH for the wrong-looking target. Use the fetched app identity (ideally name plus app ID) in this approval boundary.

This issue also appears on line 1569 of the same file.

Medium severity Completeness check ignores unresolved permissions

scripts/​bulk-agent-registration/​New-A365AutomationApp.ps1:1270

This completeness check only considers permissions that resolved successfully. Roles recorded in $missing and delegated scopes skipped as unpublished never enter these collections, so a partially enrolled tenant can be told that all selected permissions are declared and be sent to consent to an incomplete set. Track unresolved delegated scopes as well, include all unresolved permissions in this predicate, and expose them in the summary/guidance.

Medium severity Legacy admin consent link lacks registered redirect URI

scripts/​bulk-agent-registration/​New-A365AutomationApp.ps1:1571

The script creates applications without a redirect URI, so this legacy /adminconsent link has no registered reply address and can fail with AADSTS500113 for a newly created app. That makes the advertised handoff link unusable. Either direct administrators only to the working Entra portal URL, or register a callback and generate a consent URL with its matching redirect_uri; update the summary and regression assertion consistently.

@walterluna
Walter Luna (walterluna) merged commit 1dfbf01 into microsoft:main Oct 1, 2026
6 checks passed
@walterluna
Walter Luna (walterluna) deleted the update-bulk-onboarding-app-creation branch October 1, 2026 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants