Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/skills/maester-test-expert/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ Reserved names (rejected today): `OptionalService`, `TimeoutSeconds`.

Licence tokens: `AAD_PREMIUM` (Entra ID P1 or better), `AAD_PREMIUM_P2`, `Entra_Identity_Governance`,
`AAD_WRKLDID_P1`, `AAD_WRKLDID_P2`, `ATP_ENTERPRISE` (MDO P1 or P2), `THREAT_INTELLIGENCE` (MDO P2),
`SAFEDOCS` (Safe Documents, which neither MDO plan includes),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
`EOP_ENTERPRISE`, `EXCHANGE_S_STANDARD`, `EXCHANGE_DLP`, `M365_ADVANCED_AUDITING`, `DEFENDER_XDR`,
`LOCKBOX_ENTERPRISE`, `INTUNE_A`. Built-in checks use only these; add a token to the table if you need a new one.

Expand Down
7 changes: 5 additions & 2 deletions build/orca/Update-OrcaTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
tests/orca/Test.ORCA.<n>.ps1 with one [MaesterTest] function, and tests/orca/Test.ORCA.<n>.md.
Maester metadata that ORCA does not carry (severity, author, contributors and the classification
attributes RelatedProduct, Feature, Area, ResourceType, UserImpact, ImplementationCost and Mitre) is
read from build/orca/orca-test-metadata.json. Edit that file, never the generated tests.
read from build/orca/orca-test-metadata.json, as is License for a check whose feature Defender for
Office 365 does not include. Edit that file, never the generated tests.

.PARAMETER Offline
Regenerates only the native tests from the committed check files. Nothing is downloaded.
Expand Down Expand Up @@ -356,7 +357,9 @@ foreach ($check in $checks) {
if ($meta.Control) { $attribute.Add("Control = $(Format-OrcaList @($meta.Control))") }
$attribute.Add("Service = $(Format-OrcaList $services)")
# Defender for Office 365 Plan 1 or 2. ORCA detects MDO itself and reports 'not completed' without it.
if ($check.Services -eq 'MDO') { $attribute.Add("License = 'ATP_ENTERPRISE'") }
# A check of a feature that neither plan includes, such as Safe Documents, names its licence in the metadata.
if ($meta.License) { $attribute.Add("License = $(Format-OrcaList @($meta.License))") }
elseif ($check.Services -eq 'MDO') { $attribute.Add("License = 'ATP_ENTERPRISE'") }
$attribute.Add("Author = $(Format-OrcaList @($meta.Author))")
if ($meta.Contributor) { $attribute.Add("Contributor = $(Format-OrcaList @($meta.Contributor))") }
$attributeText = ($attribute | ForEach-Object { " $_" }) -join ",`n"
Expand Down
2 changes: 2 additions & 0 deletions build/orca/orca-test-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@
},
"ORCA.225": {
"Severity": "Medium",
"License": "SAFEDOCS",
"Author": [
"soulemike"
],
Expand Down Expand Up @@ -1130,6 +1131,7 @@
},
"ORCA.234": {
"Severity": "Medium",
"License": "SAFEDOCS",
"Author": [
"soulemike"
],
Expand Down
3 changes: 3 additions & 0 deletions powershell/assets/MaesterLicenseTable.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
THREAT_INTELLIGENCE = @{ ServicePlanIds = @('8e0c0a52-6a6c-4d40-8370-dd62790dcd70', '900018f1-0cdb-4ecb-94d4-90281760fdc6'); SkuIds = @('8e0c0a52-6a6c-4d40-8370-dd62790dcd70', '900018f1-0cdb-4ecb-94d4-90281760fdc6'); LegacySkipCode = 'NotLicensedMdo' }
# Defender for Office 365 Plan 1 or Plan 2 (incl. GOV).
ATP_ENTERPRISE = @{ DisplayName = 'Microsoft Defender for Office 365 Plan 1 or Plan 2'; ServicePlanIds = @('f20fedf3-f3c3-43c3-8267-2bfdd51c0939', '493ff600-6a2b-4db6-ad37-a7d4eb214516', '8e0c0a52-6a6c-4d40-8370-dd62790dcd70', '900018f1-0cdb-4ecb-94d4-90281760fdc6'); LegacySkipCode = 'NotLicensedMdoP1' }
# Safe Documents: Microsoft 365 A5, E5 and G5, and Microsoft Defender Suite. Neither Defender for Office 365 plan
# includes it, so ATP_ENTERPRISE does not cover it. 2.x had no code for it.
SAFEDOCS = @{ ServicePlanIds = @('bf6f5520-59e3-4f82-974b-7dbbc4fd27c7'); LegacySkipCode = 'Custom' }
M365_ADVANCED_AUDITING = @{ ServicePlanIds = @('2f442157-a11c-46b9-ae5b-6e39ff4e5849'); SkuIds = @('2f442157-a11c-46b9-ae5b-6e39ff4e5849'); LegacySkipCode = 'NotLicensedAdvAudit' }
# Any Exchange Online mailbox licence.
EXCHANGE_S_STANDARD = @{
Expand Down
25 changes: 24 additions & 1 deletion powershell/tests/functions/engine/NativeLicenseGates.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
$p2OrGovernance = @{ License = @('AAD_PREMIUM_P2', 'Entra_Identity_Governance'); Legacy = 'NotLicensedEntraIDP2' }
$p2AndAgent365 = @{ License = @('AAD_PREMIUM_P2&AGENT_365'); Legacy = 'NotLicensedEntraIDP2' }
$mdoP1 = @{ License = @('ATP_ENTERPRISE'); Legacy = 'NotLicensedMdoP1' }
# CIS.M365.2.1.5 also requires Safe Documents, which neither Defender for Office 365 plan includes (2.x gated it on Plan 1).
$safeDocs = @{ License = @('SAFEDOCS'); Legacy = 'Custom' }
$exoDlp = @{ License = @('EXCHANGE_DLP'); Legacy = 'NotLicensedExoDlp' }
$intune = @{ License = @('INTUNE_A'); Legacy = 'NotLicensedIntune' }
$converted = [ordered]@{
Expand All @@ -20,7 +22,7 @@
'CISA.MS.EXO.17.3' = @{ License = @('M365_ADVANCED_AUDITING'); Legacy = 'NotLicensedAdvAudit' }
'CISA.MS.EXO.8.1' = $exoDlp; 'CISA.MS.EXO.8.2' = $exoDlp; 'CISA.MS.EXO.8.4' = $exoDlp
'CIS.M365.1.3.6' = @{ License = @('LOCKBOX_ENTERPRISE'); Legacy = 'NotLicensedCustomerLockbox' }
'CIS.M365.2.1.1' = $mdoP1; 'CIS.M365.2.1.4' = $mdoP1; 'CIS.M365.2.1.5' = $mdoP1; 'CIS.M365.2.1.7' = $mdoP1
'CIS.M365.2.1.1' = $mdoP1; 'CIS.M365.2.1.4' = $mdoP1; 'CIS.M365.2.1.5' = $safeDocs; 'CIS.M365.2.1.7' = $mdoP1
'MT.1053' = $intune; 'MT.1096' = $intune; 'MT.1102' = $intune; 'MT.1105' = $intune
'MT.1106' = $p2OrGovernance; 'MT.1107' = $p2OrGovernance; 'MT.1108' = $p2OrGovernance; 'MT.1109' = $p2OrGovernance; 'MT.1110' = $p2OrGovernance
'MT.1175' = $exoDlp
Expand Down Expand Up @@ -93,6 +95,15 @@ Describe 'Licence gates of converted tests' {
}
}

It 'Skip the Safe Documents checks on a tenant with Defender for Office 365 alone' {
# Defender for Office 365 Plan 1, part of Microsoft 365 E3 since July 2026, does not include Safe Documents.
foreach ($id in 'ORCA.225', 'ORCA.234', 'CIS.M365.2.1.5') {
(@((Get-MtTest -Id $id).License) -join ',') | Should -Be 'SAFEDOCS' -Because "$id checks a Safe Documents setting"
$row = Invoke-MtTest -Id $id -Config (New-Config -Licenses 'ATP_ENTERPRISE')
$row.ReasonCode | Should -Be 'LicenseNotFound' -Because "$id needs the SAFEDOCS service plan, not only Defender for Office 365"
}
}

It 'Run MT.1181 on a tenant with both Entra ID P2 and Agent 365' {
# The mocks return no Conditional Access policy, so the body runs and finds no blocking policy.
$row = Invoke-MtTest -Id 'MT.1181' -Config (New-Config -Licenses 'AAD_PREMIUM_P2', 'AGENT_365')
Expand Down Expand Up @@ -159,6 +170,18 @@ Describe 'Licence skip message' {
$met | Should -BeTrue
}

It 'Counts the SAFEDOCS service plan as Safe Documents, and the Defender for Office 365 plans as not' {
$met = InModuleScope Maester {
Test-MtLicenseRequirement -Requirement 'SAFEDOCS' -Licenses ([pscustomobject]@{ ServicePlanIds = @('bf6f5520-59e3-4f82-974b-7dbbc4fd27c7'); SkuIds = @(); ServicePlanNames = @() })
}
$met | Should -BeTrue
# ATP_ENTERPRISE (Plan 1) and THREAT_INTELLIGENCE (Plan 2) do not include Safe Documents.
$notMet = InModuleScope Maester {
Test-MtLicenseRequirement -Requirement 'SAFEDOCS' -Licenses ([pscustomobject]@{ ServicePlanIds = @('f20fedf3-f3c3-43c3-8267-2bfdd51c0939', '8e0c0a52-6a6c-4d40-8370-dd62790dcd70'); SkuIds = @(); ServicePlanNames = @() })
}
$notMet | Should -BeFalse
}

It 'Gives every licence token a friendly name, from Microsoft or the table' {
$unnamed = InModuleScope Maester {
$table = Get-MtLicenseTable
Expand Down
7 changes: 6 additions & 1 deletion tests/cis/Test.CIS.M365.2.1.5.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
Safe Attachments for SharePoint, OneDrive, and Microsoft Teams should be enabled
CIS Microsoft 365 Foundations Benchmark v7.0.0 (2.1.5, L2)

The control also requires Safe Documents, which needs the SAFEDOCS service plan (Microsoft 365 A5, E5 or G5,
or Microsoft Defender Suite) and is not part of Defender for Office 365 Plan 1 or Plan 2. When Maester can read
the tenant's licences, it skips the check on a tenant without that plan; when it cannot, the check runs.
ORCA.158 checks the SharePoint, OneDrive and Teams setting on any Defender for Office 365 tenant.

.EXAMPLE
Test-MtCisSafeAttachmentsAtpPolicy

Expand All @@ -29,7 +34,7 @@
Mitre = ('T1080', 'T1204.002'),
Control = ('cis-m365:2.1.5', 'nist-800-53-r5:SI-3'),
Service = ('ExchangeOnline', 'Graph'),
License = 'ATP_ENTERPRISE',
License = 'SAFEDOCS',
Author = 'NZLostboy'
)]
[CmdletBinding()]
Expand Down
2 changes: 1 addition & 1 deletion tests/orca/Test.ORCA.225.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Test-ORCA225 {
Mitre = 'T1204.002',
Control = 'nist-800-53-r5:SI-3',
Service = 'ExchangeOnline',
License = 'ATP_ENTERPRISE',
License = 'SAFEDOCS',
Author = 'soulemike'
)]
[CmdletBinding()]
Expand Down
2 changes: 1 addition & 1 deletion tests/orca/Test.ORCA.234.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Test-ORCA234 {
Mitre = 'T1204.002',
Control = 'nist-800-53-r5:SI-3',
Service = 'ExchangeOnline',
License = 'ATP_ENTERPRISE',
License = 'SAFEDOCS',
Author = 'soulemike'
)]
[CmdletBinding()]
Expand Down
1 change: 1 addition & 0 deletions website/docs/writing-tests/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ government, education and suite variants match too:
| `AAD_WRKLDID_P1`, `AAD_WRKLDID_P2` | Workload ID P1 or better, Workload ID P2 |
| `ATP_ENTERPRISE` | Defender for Office 365 Plan 1 or Plan 2 |
| `THREAT_INTELLIGENCE` | Defender for Office 365 Plan 2 |
| `SAFEDOCS` | Safe Documents (Microsoft 365 A5, E5 or G5, or Microsoft Defender Suite); not part of Defender for Office 365 |
| `EOP_ENTERPRISE` | Exchange Online Protection |
| `EXCHANGE_S_STANDARD` | Any Exchange Online mailbox licence |
| `EXCHANGE_DLP` | Exchange Online DLP (Exchange Online Plan 2, the DLP plan, or Microsoft 365 Business Premium) |
Expand Down
1 change: 1 addition & 0 deletions website/src/data/test-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@
"INTUNE_A",
"LOCKBOX_ENTERPRISE",
"M365_ADVANCED_AUDITING",
"SAFEDOCS",
"THREAT_INTELLIGENCE"
],
"suites": [
Expand Down
Loading