Skip to content

Fix Access Reviews contactedReviewers failing with 'Invalid guid'#116

Open
rgunst wants to merge 1 commit intomicrosoft:mainfrom
rgunst:fix/access-review-nested-placeholder
Open

Fix Access Reviews contactedReviewers failing with 'Invalid guid'#116
rgunst wants to merge 1 commit intomicrosoft:mainfrom
rgunst:fix/access-review-nested-placeholder

Conversation

@rgunst
Copy link

@rgunst rgunst commented Mar 11, 2026

Summary

  • The contactedReviewers grandchild endpoint URL template contains two <placeholder> tokens: definitions/<placeholder>/instances/<placeholder>/contactedReviewers
  • New-GraphBatchRequest replaces all <placeholder> occurrences with the same value (the instance ID), so both slots get the instance ID instead of using the definition ID for the first and the instance ID for the second
  • This causes 400 errors like Invalid guid 2G3-4TG6YU2J54hjnaRoPQE passed in when definition IDs use non-GUID formatted strings

Changes

Modified _processChildrenRecursive in src/Export-Entra.ps1 to detect children whose GraphUri contains multiple <placeholder> tokens. When found, it queues them per parent ID with the first (ancestor) placeholder pre-resolved, leaving exactly one <placeholder> for the batch request to fill with the correct child ID.

Test plan

  • Ran Export-Entra -Type AccessReviews — contactedReviewers URLs now correctly use definitions/{defId}/instances/{instanceId}/contactedReviewers with distinct IDs
  • Zero 400 errors, zero "Invalid guid" errors
  • Reviewers data exported successfully
  • Verified Join-Path chain matches request ID construction for cross-platform compatibility

Fixes #115

The contactedReviewers grandchild endpoint uses a URL template with two
<placeholder> tokens:
  definitions/<placeholder>/instances/<placeholder>/contactedReviewers

New-GraphBatchRequest replaces ALL <placeholder> occurrences with the
same value (the instance ID), causing both the definition ID and instance
ID slots to get the instance ID. This results in 400 errors like
"Invalid guid 2G3-4TG6YU2J54hjnaRoPQE passed in" when definition IDs
are non-GUID formatted strings.

Fix: when _processChildrenRecursive encounters children whose GraphUri
contains multiple <placeholder> tokens, it now queues them per parent ID
with the first (ancestor) placeholder pre-resolved. This leaves exactly
one <placeholder> for the batch request to fill with the correct child
ID.

Fixes microsoft#115
@rgunst
Copy link
Author

rgunst commented Mar 11, 2026

This fix was primarily developed using Claude Code (AI pair programming). I guided the process, validated the code changes, and tested the results against a production tenant.

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.

Access Reviews contactedReviewers export fails with 'Invalid guid' on non-GUID definition IDs

2 participants