Enable portal-only admin consent for bulk onboarding - #502
Open
Walter Luna (walterluna) wants to merge 2 commits into
Open
Walter Luna (walterluna) wants to merge 2 commits into
Walter Luna (walterluna) wants to merge 2 commits into
Conversation
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 started reviewing on behalf of
Walter Luna (walterluna)
September 23, 2026 15:30
View session
Contributor
There was a problem hiding this comment.
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
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
-SkipGrantbehavior 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.
Copilot started reviewing on behalf of
Walter Luna (walterluna)
September 23, 2026 15:42
View session
Contributor
There was a problem hiding this comment.
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
Open (3)
Resolved since last review (1)
Comment on lines
+268
to
+270
| $existingKeys = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase) | ||
| foreach ($access in $graphAccess) { | ||
| [void]$existingKeys.Add(('{0}|{1}' -f $access.type, $access.id)) |
Comment on lines
+1201
to
+1205
| if ($permissionMerge.Changed) { | ||
| $payload = @{ requiredResourceAccess = $permissionMerge.RequiredResourceAccess } | ||
| $changeDescription = "+$($permissionMerge.RolesAdded.Count) application permission(s), +$($permissionMerge.ScopesAdded.Count) delegated scope(s)" | ||
| if ($PSCmdlet.ShouldProcess($DisplayName, "PATCH requiredResourceAccess ($changeDescription)")) { | ||
| Invoke-Graph -Method PATCH -Uri "/applications/$applicationObjectId" -Body $payload | Out-Null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



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