Maester is a PowerShell framework for monitoring Microsoft 365 security
configuration, with its own test engine. Pester is used only for the module's unit tests
and to run users' Pester-format custom tests. Requires PowerShell 7.4+. Monorepo: powershell/ (module source),
tests/ (security checks shipped to users), src/Maester.Engine/ (C# engine core,
built DLL committed in powershell/lib/), build/, website/ (Astro + Starlight,
maester.dev), report/ (React app that builds the HTML report template).
tests/— Maester security checks that ship to end-user tenants, run viaInvoke-Maester. Each check is a native test:tests/<suite>/[<service>/]Test.<ID>.ps1(one function with a[MaesterTest(...)]attribute) plusTest.<ID>.md. No*.Tests.ps1wrappers, no connection/licence guards, no outer try/catch: declareService/Licenseand the engine handles them. Scaffold withNew-MtTest, validate withGet-MtTest <ID>(Get-MtTest -Pathapplies the rules of a custom test and does not report a missing attribute), run withInvoke-MtTest -Path;Convert-MtTestconverts users' Pester-format tests. New MT.xxxx checks go here; follow.github/skills/maester-test-expert/SKILL.mdandwebsite/docs/writing-tests/index.mdx, and choose the attribute values withwebsite/docs/writing-tests/attribute-rubric.md(see "Reviewing a test's attributes" below). A benchmark test for a requirement that another suite already checks is a shim that returns that test's result (see "Reviewing a test for duplicates" below).powershell/tests/— unit tests for the module itself.
- Unit tests:
./powershell/tests/pester.ps1— run before pushing. These enforce naming, exports, help, and PSScriptAnalyzer conventions; fix what they flag. - Build module:
./build/Build-MaesterModule.ps1; validate:./build/Test-MaesterModuleOutput.ps1 - Website:
cd website && npm ci && npm start· Report:cd report && npm ci && npm run build
- Generated content — regenerate, never hand-edit:
website/src/data/versions.json,website/versioned_docs/(the frozen 2.x docs), everything underpowershell/internal/generated/, and the nativetests/eidsca/Test.EIDSCA.*andtests/orca/Test.ORCA.*files the generators inbuild/eidsca/andbuild/orca/write. Edit the PowerShell source, comment-based help or generator templates and let automation regenerate.powershell/assets/MaesterServicePlanNames.json(Microsoft's friendly name for each licence service plan) is written withwebsite/src/data/license-service-plans.jsonbywebsite/scripts/update-license-service-plans.mjs.powershell/assets/ConsoleContributors.json(the dashboard's Featured contributor list) is written by./build/Update-ConsoleContributors.ps1from the website's contributor data. - Never commit the website data that each build generates: the command pages in
website/docs/commands/(everything butreadme.mdx),website/src/data/test-catalog.json,contributors.json,sponsors.json,community-packs.jsonandcatalog-history.json. They are ignored by git.website/scripts/prepare-data.mjswrites them from the module source, the git history, GitHub and packs.maester.cloud beforenpm run devandnpm run build;npm run refresh-datawrites them again. The build-website workflow builds and deploys maester.dev from main, so a merge needs no follow-up PR. - A test is mapped to a framework in one place: the
Controlattribute,<framework-key>:<requirement-id>. A CIS test carriesControl = 'cis-m365:5.1.5.1', a CISA testControl = 'cisa-scuba:MS.AAD.3.1', and any other test may name the same requirements. An ASD test carriesControl = 'essential-eight:ISM-1504'(orism:<id>for a control outside the maturity model). A DISA test carries the STIG rule it checks,Control = 'disa-stig-entra-id:V-270233'. Every test intests/cis,tests/cisa,tests/asdandtests/disamust name a requirement of its suite's framework. The engine buildsBenchmarkfrom the firstControlthat a framework file knows and adds that requirement'sRelatedreferences toControl; do not repeat those, and do not add benchmark tags. - A framework file is a catalogue, not a list of tests:
tests/<suite>/frameworks/<key>.json(tests/cis/frameworks/cis-m365.json,tests/cis/frameworks/cis-github.json,tests/cisa/frameworks/cisa-scuba.json, and the generatedtests/asd/frameworks/essential-eight.jsonandtests/asd/frameworks/ism.json, written bybuild/asd/Update-AsdFramework.ps1from the ISM OSCAL release, and the DISA STIG filestests/disa/frameworks/disa-stig-entra-id.json,disa-stig-intune-mdm.jsonanddisa-stig-intune-desktop.json), declared in the suite'ssuite.json(Frameworks:Key,Version). It holds the framework's name and version and each requirement'sIdand facts (CISLevelandProfile; CISACriticality,UpstreamandRelatedNIST references; Essential EightLevelandStrategy; ISMGuideline,SectionandApplicability; DISA STIGCategory,RuleIdandStigId), never the text of a benchmark and never aTestslist. When a new test implements a requirement the file does not have, add the requirement in the same commit, or./build/Build-MaesterModule.ps1and the unit tests fail. - Checks read through the session cache. A run reports on one snapshot of the tenant, so no check, pack or helper
passes
-DisableCacheor otherwise bypasses the Graph or GitHub cache, even to read data that changed during the session. Only the transport helpers listed inpowershell/tests/general/GraphCacheUsage.Tests.ps1may offer the switch, and that test fails on any other use. Don't apply a review suggestion to bypass the cache.
Full rules and reasoning: website/docs/contributing.md ("Repository layout"), published at
https://maester.dev/docs/contributing#repository-layout. powershell/tests/general/RepositoryLayout.Tests.ps1
enforces them. When writing or reviewing a change, check every added, moved or renamed file:
- Folder names under
tests/,powershell/andbuild/are lowercase kebab-case (global-secure-access, notGlobalSecureAccess). No two paths may differ only in case. - One name per service, the same everywhere:
ad,azure,azure-devops,copilot,copilot-studio,defender,entra,exchange,fabric,foundry,github,global-secure-access,graph,intune,purview,sharepoint,teams,xspm. Folders name the product whose settings a check reads, never a theme: an AI check goes in the folder of its product (an Entra agent identity check inentra/) and declaresArea = 'ai'. A new service must be added to the guide and the test. tests/<suite>/holds onlyTest.<ID>.ps1,Test.<ID>.md,suite.jsonandREADME.md, plus the suite's framework files,frameworks/<key>.jsonbeside itssuite.json(lowercase key; nothing else goes in aframeworks/folder). Suites:maester/<service>/(plusdrift/;maester/xspm/has its own suite.json),cis/,cisa/<service>/,asd/<service>/,disa/,ad/<area>/, generatedeidsca/andorca/, andcustom/(reserved for users; never commit tests there).powershell/public/(exported) is grouped by job:run/,connect/,report/,app/,packs/,services/<service>/.powershell/internal/usesengine/,session/,connect/,report/,app/,packs/,services/<service>/,checks/<suite>/<service>/,generated/,utility/. Nothing sits directly inpublic/orinternal/.packs/<name>/at the repository root holds the Maester Packs that ship with Maester (IDmaester.<name>, a code of the pack's own such asZTA, test IDs<Code>.<n>without theMP.that installed packs use). They are not undertests/: a pack loads into its own private module, and its rows carrySource = CustomandPackage. Seepacks/README.md.- Put a function by its job, not by the check that first needed it: reusable data access
for a service goes in
internal/services/<service>/; logic only one suite's checks use goes ininternal/checks/<suite>/<service>/; a helper users call from custom tests goes inpublic/services/<service>/(and in the manifest'sFunctionsToExport). - One function per file, named
Verb-Noun.ps1after the function, with an approved verb. - Custom tests can call only exported commands. To make an internal helper available to them,
git mvit frominternal/services/<service>/topublic/services/<service>/, add it toFunctionsToExport, and give it full comment-based help (see "Making an internal helper public" in the contributing guide). Exporting a command makes it public API; flag a promotion in review.
Benchmarks overlap, and a check that CIS, CISA, ASD and Maester each implement in their own way gives two answers for one setting and drifts with every benchmark update. When you write, change or review a test, look for a duplicate before the attribute review:
- Find the tests in every suite that read the same setting (
Get-MtTest -Product <key> -Feature <key>, and a search oftests/for the Graph endpoint or setting name). - If one exists, read what the benchmark asks in its own sources, not only the requirement's one-line text: its audit or assessment guidance and any reference configuration it publishes (for ASD, the ISM, the Essential Eight assessment process guide and the ASD Blueprint for Secure Cloud). Note every concrete value they name, and whether it differs from the existing test.
- Decide, as "Tests that another suite already has" in
website/docs/writing-tests/index.mdxsays:- the benchmark asks for what the existing test checks: the new test is a shim, a test whose body is
return <the existing test's function>, with its ownId,Title,Controland guide; - it asks for the same check with a different value the existing test takes as a parameter: a shim that passes the value;
- it asks for something no test checks, or a rule no parameter covers: a test of its own, which
reads data through
powershell/internal/services/<service>/helpers instead of copying another test's logic.
- the benchmark asks for what the existing test checks: the new test is a shim, a test whose body is
- Fail the review when a benchmark test re-implements a check another suite already has and the
benchmark's sources give no reason, or when a helper named after a suite (
Get-MtAsd*,Get-MtCis*) does data access that is not specific to that suite. Say which test it duplicates and which source you read.
powershell/tests/general/TestShims.Tests.ps1 checks the mechanical part: a shim declares the same
attribute values as the test it calls (Product to Mitre, Service, License and the other gates),
calls a test that exists and is not a shim, passes only parameters that test declares, leaves its own
requirement off that test's Control, and names that test in its guide. Whether the benchmark asks for
the same thing is the reviewer's judgement.
Every built-in test declares what it is about, how urgent a failure is and which attack techniques
it addresses: Product, Feature, Area, ResourceType, Severity, UserImpact,
ImplementationCost, Mitre and, where one applies, RelatedProduct. The rules for each value
are in website/docs/writing-tests/attribute-rubric.md (the rubric); the allowed keys are in
powershell/assets/MaesterTaxonomy.psd1.
When you write, change or review a test, check its attributes against the rubric as a separate step, after the code review and before you approve or hand off:
- Read the test's
.ps1and.mdand state in one sentence what it checks and what the fix is. - For each attribute that is new or changed, decide whether the declared value fits the rubric. A value fails only when the rubric clearly gives a different one; say which value and which rule.
- Fail the review if any value does not fit. Do not approve with a note to fix it later.
Three things enforce this, in order:
powershell/tests/general/NativeTestAttributes.Tests.ps1fails on anything mechanical: a missing attribute, a key that is not in the taxonomy, a retired ATT&CK technique, a taxonomy tag on a built-in test.- The
attribute-reviewworkflow (.github/workflows/attribute-review.yaml) runs a reviewer model against the rubric on every pull request that adds a test or changes one of these attributes, and fails the check with the value it expected and the reason. It calls the Claude API with theANTHROPIC_API_KEYsecret; without the secret it reports that the review was skipped. To run the same review locally before pushing, setANTHROPIC_API_KEYand run./build/review/Invoke-MtAttributeReview.ps1 -BaseRef origin/main -OutputPath ./TestResults(TestResults/is ignored by git; without-OutputPaththe report is written to the current folder). - The person or agent reviewing the pull request applies the same rubric and is the last word. A
maintainer who disagrees with the workflow can apply the
attribute-review-overridelabel and should say why in the pull request.
Labels follow one rubric so the queue can be filtered by status, type and product. The
labels are defined in .github/labels.json; the rules for choosing them are in
.github/skills/maester-triage/SKILL.md. To triage, use the maester-triage agent (or follow
the skill directly): it shows its plan before changing anything and only ever changes labels.
After editing .github/labels.json, run ./build/github/Sync-GitHubLabels.ps1 to see the
changes and -Apply to make them. -Apply creates, renames and updates labels and copies a merged
label onto the items that carry the old one; add -DeleteMerged to also delete the old labels.
The agents and skills in this repository are listed in website/docs/agents-and-skills.md. Each
has one source file: .github/agents/<name>.agent.md or .github/skills/<name>/SKILL.md. The
Claude Code copies under .claude/agents/ and .claude/skills/, and that docs page, are generated
from them by ./build/github/Update-AgentFiles.ps1. Edit the source file, run the script, and
commit both; never edit a generated copy. powershell/tests/general/AgentFiles.Tests.ps1 fails
when they drift.