Skip to content

Add some tests related to availability of license to show skipped (for lack of license) instead of failed#1805

Open
JeanPhilippeGeorge wants to merge 14 commits into
maester365:mainfrom
JeanPhilippeGeorge:Add-some-tests-related-to-availability-of-license-to-show-skipped-(for-lack-of-license)-instead-of-failed
Open

Add some tests related to availability of license to show skipped (for lack of license) instead of failed#1805
JeanPhilippeGeorge wants to merge 14 commits into
maester365:mainfrom
JeanPhilippeGeorge:Add-some-tests-related-to-availability-of-license-to-show-skipped-(for-lack-of-license)-instead-of-failed

Conversation

@JeanPhilippeGeorge
Copy link
Copy Markdown
Contributor

📑 Description

Add some tests related to availability of license to show skipped (for lack of license) instead of failed

✅ Checks

  • My pull request adheres to the code style of this project.
  • The build and unit tests pass after running /powershell/tests/pester.ps1 locally.
    1 test fails but there is no indication of which one ... more detail in a comment

ℹ️ Additional Information

File modified:

  • Get-MtRoleMember
    The license check make the function not throw when there is no P2 license. So user of standard license should not have Error as a result for the following tests:
    • CIS.M365.1.1.1: Ensure Administrative accounts are cloud-only
    • CIS.M365.1.1.3: Ensure that between two and four global admins are designated
    • And probably some others

Add license check in the following functions and correct some tests to check for $null to correctly handle the skipped

  • Test-MtEntitlementManagementValidResourceRoles
    Test: MT.1106: Catalog resources must have valid roles (no stale / removed app roles or SPNs)
  • Test-MtEntitlementManagementDeletedGroups
    Test: MT.1107: Access packages and catalogs should not reference deleted groups
  • Test-MtEntitlementManagementInactivePolicies
    Test: MT.1108: Access packages should not reference inactive or orphaned assignment policies
  • Test-MtEntitlementManagementOrphanedResources
    Test: MT.1110: No catalog should contain resources without any associated access packages
  • Test-MtEntitlementManagementValidApprovers
    Test: MT.1109: Access package approval workflows must have valid approvers

@JeanPhilippeGeorge JeanPhilippeGeorge requested review from a team as code owners May 29, 2026 10:08
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 29, 2026

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.

@JeanPhilippeGeorge
Copy link
Copy Markdown
Contributor Author

JeanPhilippeGeorge commented May 29, 2026

As said before: one test is failing but there is no information of the failing test.

Any help appreciated.

Output of the command:

./powershell/tests/pester.ps1
Starting Tests
Importing Module
WARNING: The names of some imported commands from the module 'Pester' include unapproved verbs that might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the Verbose parameter. For a list of approved verbs, type Get-Verb.
[11:32:27][pester.ps1] Creating test result folder
[11:32:27][pester.ps1] Modules imported, proceeding with general tests
[11:32:27][pester.ps1]   Executing Build-MaesterModule.Tests.ps1
[11:32:28][pester.ps1]   Executing Help.Tests.ps1
[11:32:41][pester.ps1]   Executing Manifest.Tests.ps1
[11:32:43][pester.ps1]   Executing Module.Tests.ps1
[11:32:44][pester.ps1]   Executing PSScriptAnalyzer.Tests.ps1
[11:33:06][pester.ps1] Proceeding with individual tests
[11:33:06][pester.ps1]   Executing Common.Tests.ps1
[11:33:15][pester.ps1]   Executing ConvertTo-QueryString.Tests.ps1
[11:33:16][pester.ps1]   Executing Get-IsNewMaesterVersionAvailable.Tests.ps1
[11:33:18][pester.ps1]   Executing Get-MtGraphScope.Tests.ps1
[11:33:56][pester.ps1]   Executing Get-MtHtmlReport.Tests.ps1
[11:34:03][pester.ps1]   Executing Get-MtLatestModuleVersion.Tests.ps1
[11:34:05][pester.ps1]   Executing Get-MtMaesterConfig.Tests.ps1
[11:34:30][pester.ps1]   Executing Get-MtUser.Tests.ps1
WARNING: Get-MtUser: Skipping group 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' — it has 25 members, which is too many to be an emergency access group. Emergency access groups should have only 1–2 members. Review your Conditional Access policy exclusions to confirm the correct group is being excluded.
WARNING: Get-MtUser: Skipping group 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' — it has 25 members, which is too many to be an emergency access group. Emergency access groups should have only 1–2 members. Review your Conditional Access policy exclusions to confirm the correct group is being excluded.
WARNING: Get-MtUser: Skipping group 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' — it has 50 members, which is too many to be an emergency access group. Emergency access groups should have only 1–2 members. Review your Conditional Access policy exclusions to confirm the correct group is being excluded.
WARNING: Get-MtUser: Skipping group 'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb' — it has 50 members, which is too many to be an emergency access group. Emergency access groups should have only 1–2 members. Review your Conditional Access policy exclusions to confirm the correct group is being excluded.
WARNING: Unable to retrieve members for group with GUID: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa. Error: Graph API error: group not found
WARNING: Unable to retrieve members for group with GUID: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa. Error: Graph API error: group not found
[11:34:57][pester.ps1]   Executing Import-MtMaesterResult.Tests.ps1
[11:34:59][pester.ps1]   Executing Invoke-Maester.Tests.ps1

███╗   ███╗ █████╗ ███████╗███████╗████████╗███████╗██████╗
████╗ ████║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔════╝██╔══██╗
██╔████╔██║███████║█████╗  ███████╗   ██║   █████╗  ██████╔╝
██║╚██╔╝██║██╔══██║██╔══╝  ╚════██║   ██║   ██╔══╝  ██╔══██╗
██║ ╚═╝ ██║██║  ██║███████╗███████║   ██║   ███████╗██║  ██║
╚═╝     ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝   ╚═╝   ╚══════╝╚═╝  ╚═╝ v2.0.0

WARNING: Default config file not found at C:\Projects\maester\powershell\internal\..\maester-tests\maester-config.json. Please provide a valid path to the config file.
[11:35:03][pester.ps1]   Executing MaesterConfig.Tests.ps1
[11:35:05][pester.ps1]   Executing Merge-MtMaesterResult.Tests.ps1
WARNING: No JSON result files found in directory: C:\Users\jp\AppData\Local\Temp\MaesterMergeTests_dc1ab77b3e414236b9a22a3463ae934d\empty
WARNING: No valid Maester result files were loaded.
[11:35:06][pester.ps1]   Executing Test-MtCaEmergencyAccessExists.Tests.ps1
[11:35:32][pester.ps1]   Executing Test-MtCaEnforceNonPersistentBrowserSession.Tests.ps1
[11:35:33][pester.ps1]   Executing Test-MtCaExclusionForDirectorySyncAccount.Tests.ps1
[11:35:35][pester.ps1]   Executing Test-MtCaMfaForGuest.Tests.ps1
[11:35:56][pester.ps1]   Executing Test-MtExoModernAuth.Tests.ps1
[11:36:15][pester.ps1]   Executing Update-MtRoleDefinitions.Tests.ps1
[11:36:19][pester.ps1] 1 tests out of 5586 tests failed!
Exception: C:\Projects\maester\powershell\tests\pester.ps1:236
Line |
 236 |      throw "$totalFailed / $totalRun tests failed!"
     |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | 1 / 5586 tests failed!

…cense-to-show-skipped-(for-lack-of-license)-instead-of-failed
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