Join our Newsletter — 33% off our NHI Course
Home› Guides› Maester Guide: Continuous Security Testing of Entra ID…
Guide Identity Visibility, Posture & Threat Detection

Maester Guide: Continuous Security Testing of Entra ID and Microsoft 365 Config

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 13 min read
On this page

Entra ID and Microsoft 365 settings drift every week, and a one-off assessment tells you nothing about the change an administrator made yesterday. Maester is a free, open source PowerShell framework that turns tenant security settings into automated tests you can run on a schedule, so a weakened Conditional Access policy or an opened consent setting shows up as a failed test rather than an audit finding months later. This guide explains how to install and authenticate Maester safely, what the built-in test suites cover, how to write your own tests, how to run it in a pipeline and how to triage what it reports. It is written for Microsoft 365 and Entra administrators and security engineers, and it treats the test runner's own identity as what it is: a privileged non-human identity.

This is an independent guide from NHI Mgmt Group, based on Maester's public documentation as of November 2026. It is not sponsored or reviewed by the Maester project. Product features change, so confirm settings against Maester's current documentation.

Key takeaways

  • Configuration as tests. Maester expresses security policy as tests that pass or fail against your live tenant, so drift becomes visible on every run.
  • Check the version you run. As of November 2026 the main documentation describes the 3.0 preview, while 2.3.0 is the stable release with its own archived 2.x docs; selection options, test format and result codes differ between them.
  • The runner is a privileged NHI. The pipeline app holds tenant-wide read permissions across Graph, and optionally Exchange and Teams roles. Use workload identity federation, a dedicated app and a named owner.
  • Suites map to baselines. Built-in tests include Maester's own MT checks, EIDSCA for Entra settings, CISA SCuBA (CISA.MS), CIS Microsoft 365, ORCA for Defender for Office 365 and others; you choose which apply.
  • Triage is the real work. Each result is Passed, Failed, Error, Investigate, Skipped or NotRun, and skipped tests carry a reason code that often points at a missing permission or licence rather than a secure setting.

What Maester is

Maester describes itself as a PowerShell based test automation framework for keeping Microsoft security configuration under control. Tests read tenant settings, mostly through Microsoft Graph, and compare them with an expected state. Results are produced as an HTML report and can also be written as JSON, Markdown, JUnit style output for pipelines, CSV or Excel, and sent by email or to Teams.

It complements rather than replaces a baseline. A baseline such as CISA SCuBA defines what good looks like; Maester checks the tenant against that definition every day. For the SCuBA baselines themselves, see the CISA SCuBA Baselines Guide, and for the hardening decisions behind many checks, the Active Directory and Entra ID Hardening Guide.

  • Licence: free and open source under the MIT licence.
  • Runtime: PowerShell 7.4 or later for the 3.0 preview; the docs state Windows PowerShell 5.1 is not supported.
  • Dependencies: Microsoft.Graph.Authentication installs with the module. Exchange Online, Teams, SharePoint and Azure tests need their own PowerShell modules, and tests for a service that is not connected are reported as Skipped.
  • Availability: some checks only apply where the tenant holds the relevant Microsoft licence (for example Entra ID P2 features). Maester skips these with the reason code LicenseNotFound rather than failing them.

Installing and authenticating safely

For interactive use, install from the PowerShell Gallery and pin a version so results stay comparable between runs:

  1. Install: Install-Module Maester for the stable release, or Install-Module Maester -AllowPrerelease for the preview. Pin with Install-Module Maester -RequiredVersion <version> -Scope CurrentUser.
  2. Create a working folder holding maester-config.json and a custom folder for your own tests.
  3. Connect: Connect-Maester connects to Microsoft Graph, which covers the Entra ID tests and most others. Connect-Maester -Service All adds the Microsoft 365 services; GitHub, Azure DevOps and Active Directory are connected separately.
  4. Run: Invoke-Maester, or Invoke-Maester -DryRun first to see which checks would run.

For interactive runs the documentation asks for an account that can read tenant configuration, such as Global Reader, plus View-Only Configuration for Exchange Online. Use a dedicated read-only administrator account from a privileged access workstation, not a Global Administrator session.

Where identity fits: the unattended runner

Continuous testing means an app registration that signs in without a person. The Maester GitHub setup grants it a long list of Microsoft Graph application permissions with admin consent, including Directory.Read.All, Policy.Read.All, Policy.Read.ConditionalAccess, RoleManagement.Read.All, AuditLog.Read.All, UserAuthenticationMethod.Read.All, IdentityRiskEvent.Read.All, ThreatHunting.Read.All, the DeviceManagement read permissions and SharePointTenantSettings.Read.All. Together these give a full read view of identity, device and security configuration, which is exactly what an attacker doing reconnaissance would want.

AccessWhat the docs ask forControl to apply
Microsoft GraphRead application permissions listed in the setup guide; preview tests add Application.Read.All, IdentityRiskyUser.Read.All and the agent identity read permissionsGrant only the permissions for suites you run; review the list on every upgrade. See How to find high-privilege Microsoft Graph application permissions
Write permissionReportSettings.ReadWrite.All is optional, only to disable report obfuscationLeave it out unless you have a documented need; it is the only write permission in the list
Exchange OnlineExchange.ManageAsApp plus the View-Only Configuration management role on the service principalAdd only when Exchange tests are enabled (include_exchange: true)
TeamsTeams Reader directory role, active and permanentAdd only when Teams tests are enabled; record the role assignment in your privileged role review
CredentialFederated credential (recommended) with scenario "GitHub Actions deploying Azure resources"No client secret; restrict the subject to one repository and branch or environment
  • Prefer federation: a federated credential lets the workflow exchange a GitHub OIDC token for an Entra token, so nothing long-lived is stored. Microsoft states the subject must exactly match the workflow, pattern matching is not supported for branches and tags, and a mismatch fails without a clear error. See the GitHub Actions OIDC Federation Hardening Guide.
  • Bind to an environment: use the Environment entity type with a protected GitHub environment where you can, so only approved jobs can obtain the token.
  • Constrain sign-in: where licensed, apply Conditional Access for Workload Identities and alert on sign-ins by the app from unexpected locations.
  • Audit the trust: review federated credentials on the app as part of access reviews. See How to audit Entra workload identity federated credentials.
  • Protect the report: the HTML report lists weaknesses in your tenant. Keep the pipeline repository private, limit who can download artefacts and set a retention period.

Built-in test suites

Tests ship inside the module and are identified by prefix. Suite sizes change between releases, so check the test catalogue for your version rather than relying on counts.

PrefixSource baselineTypical coverage
MT.Maester's own checksConditional Access, Privileged Identity Management, privileged roles, Intune, Defender and other Entra and Microsoft 365 settings
EIDSCA.Entra ID Security Config AnalyzerEntra authentication methods (FIDO2, Authenticator, SMS, voice), consent settings and password protection
CISA.MS.CISA SCuBA Microsoft 365 baselinesEntra ID and Exchange Online controls such as legacy authentication, phishing-resistant MFA, admin roles and audit logging
CIS.M365.CIS Microsoft 365 Foundations BenchmarkEntra, Defender, Purview, Exchange, Intune and Teams settings
ORCA.ORCA checks for Defender for Office 365Anti-spam, Safe Attachments, Safe Links and preset policies
DISA.V- and ASD.ISM-DISA STIGs; ASD Essential Eight and ISMSelected Entra and Intune requirements from each framework
ZTA.Microsoft Zero Trust Assessment packZero Trust checks across Entra, Intune, Azure, Defender and Purview
AD-, AZDO.Maester checks for other platformsOn-premises Active Directory and Azure DevOps settings, when those services are connected

Choosing suites:

  • Start narrow: run MT and EIDSCA first; they focus on Entra, where most identity risk sits, and need only Graph.
  • Add your mandated baseline: organisations aligned to SCuBA should add CISA.MS; those reporting against CIS add CIS.M365. Running both is fine, but expect overlapping findings for the same setting.
  • Use selection, not deletion: filter with -Product, -Suite, -Severity or -TestId, or store the selection in maester-config.json. In the 3.0 preview, tags are a 2.x feature and new tests carry none.
  • Set global context: declare emergency access accounts under GlobalSettings.EmergencyAccessAccounts so Conditional Access and privileged role checks treat break-glass accounts correctly instead of flagging every exclusion.

Writing custom tests

Built-in suites cover generic baselines; your own policies (naming rules, approved apps, required exclusions) need custom tests. In the 3.0 preview a native test is a PowerShell function with a [MaesterTest] attribute, while 2.x tests use the Pester *.Tests.ps1 format, which 3.0 still runs if Pester 5.7.1 or later is installed.

  1. Create the test: New-MtTest -Id CT.1001 creates Test.CT.1001.ps1 and Test.CT.1001.md in the custom folder. Use your own prefix; MT, CIS, CISA, ASD, DISA, EIDSCA, ORCA, AD and AZDO are reserved.
  2. Write the check: the attribute needs Id and Title, with Severity and Service = 'Graph' recommended. Read the setting with Invoke-MtGraphRequest -RelativeUri, explain the outcome with Add-MtTestResultDetail -Result and return exactly one $true or $false.
  3. Document the fix: the .md file explains the check and the remediation and must keep the %TestResult% placeholder.
  4. Validate offline: Get-MtTest -Path ./custom checks the files without connecting.
  5. Run alone, then with the rest: Invoke-MtTest -Path ./custom/Test.CT.1001.ps1, then Invoke-Maester or Invoke-Maester -SkipBuiltIn.

Keep custom tests read-only: a test should call GET endpoints only, so the runner never needs write permissions. Review custom tests in pull requests like any other code that runs with tenant-wide access.

Running continuously in CI

The Maester documentation provides setups for GitHub Actions, Azure DevOps and GitLab. The GitHub pattern, in order:

  1. Create a private repository holding only the workflow, maester-config.json and the custom folder.
  2. Register a dedicated Entra app (the docs use the example name "Maester DevOps Account"), add the Graph application permissions you need and grant admin consent.
  3. Add a federated credential for the repository and branch main, or better an environment.
  4. Store AZURE_TENANT_ID and AZURE_CLIENT_ID as repository secrets. These are identifiers, not credentials, but keeping them as secrets avoids publishing tenant details.
  5. Use the documented action maester365/maester-action, which takes tenant_id, client_id, version inputs and include_exchange / include_teams switches. The recommended workflow runs daily (cron 30 7 * * *), on pushes to main and on demand.
  6. Pin the action to a release or commit SHA rather than @main, and pin the Maester version, so a change upstream does not alter results or code paths silently.

The helper New-MtMaesterApp -GitHubActions -SetGitHubSecrets can create the app, permissions, federated credential and secrets in one step. If you use it, review the resulting app afterwards and remove any permissions for suites you do not run.

Roll out in rings: run interactively once and review, then schedule in a non-production tenant, then production with alerts going to a small group, and only then route failures into ticketing. To roll back, disable the workflow and remove the federated credential; the app has no secret to revoke.

On failure behaviour, the docs state that errors Maester raises without running a test fail the run, while errors thrown by a test only fail it when Output.ErrorsAsFailures is set. If you want the pipeline to fail on failed tests, use -PassThru and check FailedCount, as the documentation's example does.

Acting on results

ResultMeaningFirst action
FailedThe setting does not meet the testConfirm against the portal, then fix or record a justified exception
InvestigateNeeds human judgementAssign an owner to decide; do not leave it open indefinitely
SkippedNot applicable here or now, with a reason code such as ServiceNotConnected or LicenseNotFoundCheck whether a missing connection or permission is hiding a real gap
NotRunNot run because of your selection, for example DisabledByConfig or ExcludedByIdReview exclusions each quarter
ErrorTest, configuration or file problem, for example InvalidConfiguration or TimeoutFix the run; an erroring test protects nothing
PassedSetting meets the testTrack trend; a pass that becomes a fail is drift
  • Exceptions in config, with reasons: disable a test with a TestSettings row containing "Enabled": false and a "Reason", so the exception is versioned and reviewable in Git.
  • Severity to your risk: override severity per test in TestSettings (Critical, High, Medium, Low, Info) and set remediation targets by severity.
  • Drift alerts: alert on any Critical or High test that changes from Passed to Failed between runs, and correlate with Entra audit logs to find who made the change.

Metrics that show it is working:

  • Pass rate per suite and severity, tracked over time.
  • Mean time from a new Failed result to fix or approved exception.
  • Number of tests Skipped for ServiceNotConnected or permission reasons (should trend to zero for suites in scope).
  • Number of active exceptions and their age.
  • Run success rate of the scheduled workflow.

Framework mapping

FrameworkReferenceHow Maester supports it
NIST CSF 2.0PR.PS-01Configuration management practices established and applied
NIST CSF 2.0DE.CM-09Monitoring of software and runtime environments for adverse events
NIST SP 800-53 Rev. 5CM-2, CM-6Baseline configuration and configuration settings verified automatically
NIST SP 800-53 Rev. 5CA-7Continuous monitoring through scheduled runs
NIST SP 800-53 Rev. 5AC-6Least privilege applied to the runner identity
CIS Controls v8.1Control 4Secure configuration of enterprise assets and software. See the CIS Control 4 Secure Configuration of Enterprise Assets and Software Guide

Practitioner checklist

  • Confirm which Maester version you run and read the matching documentation set.
  • Use a dedicated app registration with a named owner for unattended runs, and no client secret.
  • Bind the federated credential to one repository and a protected environment or branch.
  • Grant only the Graph permissions, Exchange role and Teams role for suites you actually run; leave out ReportSettings.ReadWrite.All unless needed.
  • Declare emergency access accounts in GlobalSettings before reading Conditional Access results.
  • Pin the action and module versions and review upgrades for new permissions.
  • Record every exception in maester-config.json with a reason, and review quarterly.
  • Investigate Skipped results caused by missing connections or permissions.
  • Restrict access to reports and pipeline artefacts and set retention.
  • Alert on Critical and High tests that move from Passed to Failed.

Standards and references

Related NHI Mgmt Group resources: CISA SCuBA Baselines Guide · Microsoft 365 Security Guide · Workload Identity Federation Guide · Active Directory and Entra ID Hardening Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.