Skip to content

fix(exchange): request every accepted domain in Get-MtExo - #2851

Open
julien-ly wants to merge 1 commit into
maester365:mainfrom
julien-ly:fix/exo-accepted-domain-resultsize
Open

julien-ly wants to merge 1 commit into
maester365:mainfrom
julien-ly:fix/exo-accepted-domain-resultsize

Conversation

@julien-ly

@julien-ly julien-ly commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

📑 Description

Get-MtExo -Request AcceptedDomain runs Get-AcceptedDomain without -ResultSize, so it returns at most 1,000 domains (documented default). In a tenant with more domains, every check that reads the accepted domains works on a partial list: CIS.M365.2.1.4 and CIS.M365.2.1.7 can treat a rule that lists the first 1,000 domains as covering every accepted domain, and the other readers (SPF, DKIM and DMARC checks in the CIS and CISA suites, CIS.M365.6.2.1, ORCA) only see the first 1,000.

The entry now passes -ResultSize 'Unlimited', like the other list requests in the same table.

CodeRabbit raised it on #2850. It is older than that PR and shared by all the checks above, so it gets its own PR.

✅ Checks

  • My pull request adheres to the code style of this project.
  • My code requires changes to the documentation.
  • I have updated the documentation as required.
  • The build and unit tests pass after running /powershell/tests/pester.ps1 locally.

ℹ️ Additional Information

  • New case in Get-MtExo.Tests.ps1, same pattern as the VipUser one: the request passes -ResultSize 'Unlimited'. The file passes (4 tests).
  • Live in a test tenant: Get-AcceptedDomain -ResultSize Unlimited and the updated Get-MtExo -Request AcceptedDomain return the same domains as before.
  • PSScriptAnalyzer: no findings. The full pester.ps1 run stalls on my machine (see fix(cis): 2.1.4 and 2.1.7 pass rules whose user condition limits the scope #2850), so the last box stays unchecked.

Summary by CodeRabbit

  • Bug Fixes
    • Accepted domain retrieval now requests the full set of results instead of relying on the default limit, so more domains are included when retrieving Exchange data.

Get-AcceptedDomain returns at most 1,000 domains when -ResultSize is not set. Checks that compare their targets with the accepted domains then read a partial list in tenants with more domains, and can report every domain as covered.

The AcceptedDomain request now passes -ResultSize 'Unlimited', like the other list requests in the same table.
@julien-ly
julien-ly requested a review from a team as a code owner November 21, 2026 19:20
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Get-MtExo now requests unlimited results from Get-AcceptedDomain. A test checks that the command receives ResultSize set to Unlimited.

Changes: Accepted domain result size

Layer / File(s) Summary
Update mapping and test
powershell/public/services/exchange/Get-MtExo.ps1, powershell/tests/functions/Get-MtExo.Tests.ps1
The AcceptedDomain mapping passes -ResultSize 'Unlimited'. The test mock returns the requested value, and the test asserts that the result has ResultSize set to Unlimited.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested labels: bug

Suggested reviewers: merill, jeremyfinney-lgtm

Merge Risk: Minimal · up to 53e82

Accepted-domain lookups will now return every domain instead of the first 1,000, so checks no longer run on a partial list in large tenants. The change is small and easy to revert, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(exchange): request every accepted domain in Get-MtExo" matches the single change in the changeset. Get-MtExo now passes -ResultSize 'Unlimited' to Get-AcceptedDomain, and a test covers …
Description check Passed The description covers the problem, the fix, and the test and live-tenant verification. It explains that Get-AcceptedDomain returns at most 1,000 domains by default and that the change passes -ResultS…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(exchange): request every accepted domain in Get-MtExo" matches the single change in the changeset. Get-MtExo now passes -ResultSize 'Unlimited' to Get-AcceptedDomain, and a test covers it. The title is concise, specific, and names the main fix.

Full details: Description check

Explanation

The description covers the problem, the fix, and the test and live-tenant verification. It explains that Get-AcceptedDomain returns at most 1,000 domains by default and that the change passes -ResultSize 'Unlimited'. It states the new test case and the PSScriptAnalyzer result, and it notes that the full pester.ps1 run did not finish. It keeps the template's Checks section. The 'Closes #' issue reference is left blank, and the documentation checkboxes are unchecked. These gaps are minor, so the description is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 512a076 and 53e82ce.

Files selected for processing: 2

  • powershell/public/services/exchange/Get-MtExo.ps1
  • powershell/tests/functions/Get-MtExo.Tests.ps1

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@julien-ly

Copy link
Copy Markdown
Contributor Author

The ubuntu-latest job fails on 4 tests that fail the same way on other open PRs (for example this run on the feat(ad) branch): FileEncoding on Invoke-MtPackGitHubRequest.Tests.ps1, the two emergency access auto-detection tests and the Agent Identity policy test. Windows and macOS pass. None of them touch this change.

This branch has not been deployed

No deployments
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.

1 participant