From 53e82cec408b74c3c0983e31b239f87f296d386e Mon Sep 17 00:00:00 2001 From: Julien Ly Date: Sat, 21 Nov 2026 20:20:20 +0100 Subject: [PATCH] fix(exchange): request every accepted domain in Get-MtExo 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. --- .../public/services/exchange/Get-MtExo.ps1 | 2 +- powershell/tests/functions/Get-MtExo.Tests.ps1 | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/powershell/public/services/exchange/Get-MtExo.ps1 b/powershell/public/services/exchange/Get-MtExo.ps1 index f78d5f7209..9fc29da7e7 100644 --- a/powershell/public/services/exchange/Get-MtExo.ps1 +++ b/powershell/public/services/exchange/Get-MtExo.ps1 @@ -36,7 +36,7 @@ ### - add them to the hashtable below ### - confirm the command's return type is in OutputType (e.g. (Get-AcceptedDomain).GetType().Name) $commands = @{ - "AcceptedDomain" = "Get-AcceptedDomain" + "AcceptedDomain" = "Get-AcceptedDomain -ResultSize 'Unlimited'" "RemoteDomain" = "Get-RemoteDomain" "TransportConfig" = "Get-TransportConfig" "TransportRule" = "Get-TransportRule" diff --git a/powershell/tests/functions/Get-MtExo.Tests.ps1 b/powershell/tests/functions/Get-MtExo.Tests.ps1 index d2f2fc4a7d..db1d0efd52 100644 --- a/powershell/tests/functions/Get-MtExo.Tests.ps1 +++ b/powershell/tests/functions/Get-MtExo.Tests.ps1 @@ -25,10 +25,17 @@ [PSCustomObject]@{ UserPrincipalName = 'vip@example.test'; IsVIP = $IsVIP.IsPresent; ResultSize = $ResultSize } } } | Import-Module -Global -Force + New-Module -Name tmpEXO_domain_mttest -ScriptBlock { + function Get-AcceptedDomain { + [CmdletBinding()] + param([string]$ResultSize) + [PSCustomObject]@{ Name = 'contoso.com'; ResultSize = $ResultSize } + } + } | Import-Module -Global -Force } AfterAll { - Remove-Module tmpEXO_restricted_mttest, tmpEXO_mttest, tmpEOP_mttest, tmpEXO_vip_mttest -Force -ErrorAction SilentlyContinue + Remove-Module tmpEXO_restricted_mttest, tmpEXO_mttest, tmpEOP_mttest, tmpEXO_vip_mttest, tmpEXO_domain_mttest -Force -ErrorAction SilentlyContinue Clear-MtExoCache } @@ -74,4 +81,11 @@ $vipUsers[0].IsVIP | Should -BeTrue $vipUsers[0].ResultSize | Should -Be 'Unlimited' } + + It 'Requests every accepted domain' { + $domains = @(Get-MtExo -Request AcceptedDomain) + + $domains.Count | Should -Be 1 + $domains[0].ResultSize | Should -Be 'Unlimited' + } }