diff --git a/powershell/public/Get-MtGraphScope.ps1 b/powershell/public/Get-MtGraphScope.ps1 index 4ca810c02..37a53d52b 100644 --- a/powershell/public/Get-MtGraphScope.ps1 +++ b/powershell/public/Get-MtGraphScope.ps1 @@ -57,6 +57,7 @@ 'DeviceManagementServiceConfig.Read.All' 'Directory.Read.All' 'DirectoryRecommendations.Read.All' + 'EntitlementManagement.Read.All' 'IdentityRiskEvent.Read.All' 'OnPremDirectorySynchronization.Read.All' 'OrgSettings-AppsAndServices.Read.All' diff --git a/powershell/tests/functions/Get-MtGraphScope.Tests.ps1 b/powershell/tests/functions/Get-MtGraphScope.Tests.ps1 new file mode 100644 index 000000000..94fe49e65 --- /dev/null +++ b/powershell/tests/functions/Get-MtGraphScope.Tests.ps1 @@ -0,0 +1,21 @@ +Describe 'Get-MtGraphScope' { + BeforeAll { + Import-Module $PSScriptRoot/../../Maester.psd1 -Force + } + + It 'Includes EntitlementManagement.Read.All in default scopes' { + $scopes = Get-MtGraphScope + + $scopes | Should -Contain 'EntitlementManagement.Read.All' + } + + It 'Keeps EntitlementManagement.Read.All in sorted position between DirectoryRecommendations and IdentityRiskEvent' { + $scopes = Get-MtGraphScope + $directoryRecommendationsIndex = [array]::IndexOf($scopes, 'DirectoryRecommendations.Read.All') + $entitlementManagementIndex = [array]::IndexOf($scopes, 'EntitlementManagement.Read.All') + $identityRiskEventIndex = [array]::IndexOf($scopes, 'IdentityRiskEvent.Read.All') + + $directoryRecommendationsIndex | Should -BeLessThan $entitlementManagementIndex + $entitlementManagementIndex | Should -BeLessThan $identityRiskEventIndex + } +}