
Checking a Microsoft 365 tenant once is easy. Checking it every week, and noticing the one setting somebody quietly changed, is where most of us fall over. Maester is an open source PowerShell framework built for exactly that job, and Maester 3 is a big change. This post covers how I would set it up with Grok Bot, what to ask it, and how to run it on a schedule.
One honest note first. I checked the official sources on 30 November 2026. The stable release on the PowerShell Gallery is still 2.3.0, and Maester 3 is published as a pre-release, currently 3.0.0-rc83 (12 November 2026). The Maester docs describe the 3.0 preview, which is what this article follows. Check the Gallery for the current version before you start.
Why Maester, and why with an agent
Maester runs a large library of read-only security checks against your tenant and gives you an HTML report. It is the kind of work an agent is good at: install the tooling, run it, read a long report, explain the failures and do the same thing again next week. You still decide what to change. Grok Bot has its own persistent Linux computer, so it can install PowerShell 7 and the Maester module, keep the results between runs and report back in chat, Teams or email. If you are new to giving a bot access to Microsoft 365, read How to Set Up a Microsoft 365 Help Desk Bot in Grok Bot Safely first.
What is new in Maester 3
The official 3.0 announcement and the upgrade guide cover the detail. The changes that matter for a bot-run deployment:
- PowerShell 7.4 or later. Windows PowerShell 5.1 is no longer supported.
- Its own test engine. The built-in tests ship inside the module and run from it. Updating the module updates the tests, so you no longer need a tests folder. Updating your tests explains it.
- Pester is optional. Maester no longer depends on it. You need Pester 5.7.1 or later only if you have Pester-format custom tests.
- Microsoft.Graph.Authentication is the one required module, version 2.27.0 or later according to the Gallery listing.
- New ways to select tests with
-Product,-Feature,-Area,-Severity,-Suiteand-TestId, plus-DryRunto see what would run. - Errors are reported separately. A built-in test that throws is now Error, not Failed, so your failed count can drop while errors rise.
- Change tracking between runs, including a changes-since-last-run view in the HTML report.
- Native custom tests that you can create with
New-MtTest.
If Maester 2.x is already installed anywhere, remove it first. Both versions side by side can cause PowerShell to load the wrong one.
Prerequisites and the Entra app registration
For a first test, a Global Reader account and device code sign-in is fine. For scheduled runs I recommend a dedicated Entra app registration with read-only application permissions and a certificate. That way the bot never holds a person’s credentials and never gets write access.
Have an admin create the app, not the bot. Maester documents the portal steps, and also ships New-MtMaesterApp to create the app and grant the permissions. Once the app exists, upload the certificate’s public key (.cer) under Certificates & secrets. The bot keeps only the private key, as a secret.
| What | Permission or role | Needed for |
|---|---|---|
| Microsoft Graph (application, read-only) | The 27 read permissions returned by Get-MtGraphScope, such as Directory.Read.All, Policy.Read.All, Policy.Read.ConditionalAccess, AuditLog.Read.All and Reports.Read.All | Entra ID and most other tests |
| Graph, preview tests | AgentIdentity.Read.All, AgentIdentityBlueprint.Read.All, AgentIdentityBlueprintPrincipal.Read.All, Application.Read.All, IdentityRiskyUser.Read.All | Only if you run preview tests |
| Exchange Online (optional) | Exchange.ManageAsApp, plus the View-Only Configuration role assigned to the app | Exchange tests |
| Teams (optional) | Teams Reader role assigned to the app | Teams tests |
| Azure (optional) | Reader role at the scopes described in the docs | Azure tests |
| Email results (optional) | Mail.Send, limited to one mailbox with RBAC for Applications (-MailUserId is required with app permissions) | Invoke-Maester -MailRecipient |
| Teams message (optional) | A Teams webhook workflow, or delegated ChannelMessage.Send with a signed-in user | -TeamChannelWebhookUri, or -TeamId with -TeamChannelId |
Start with the Graph permissions only. Everything else is optional, and tests for services you have not connected are reported as Skipped, not failed. I would also let Grok Bot do the posting to Teams or email through its own connectors, so the Maester app never needs Mail.Send. The full lists are in the Connect-Maester guide, the email alerts guide and the Teams alerts guide.
Step-by-step setup, with prompts to give Grok Bot
1. Install PowerShell 7 and Maester 3
Check whether PowerShell 7.4 or later is installed on your computer, and install it if not. Then remove any Maester 2.x modules, install the latest Maester 3.x release (pre-release is fine, pin the exact version) with Install-Module Maester -AllowPrerelease -Scope CurrentUser, and tell me the exact version and the output of Get-Module Maester. Don’t connect to anything yet.
If you want to see the commands, they are:
Install-Module Maester -AllowPrerelease -Scope CurrentUser
Get-Module Maester -ListAvailable | Select-Object Name, Version
# only if you have Pester-format custom tests:
Install-Module Pester -MinimumVersion 5.7.1 -SkipPublisherCheck -Force -Scope CurrentUser
2. First run with device code
Run Connect-Maester -UseDeviceCode against the Contoso tenant. Show me the sign-in code and link, and wait. When I confirm, run Invoke-Maester -NonInteractive -PassThru -OutputFolder ./maester-results and summarise the counts of Passed, Failed, Error, Skipped and Investigate. Don’t change anything in the tenant.
If the sign-in says Approval required, a Global Administrator needs to consent once to the Maester permissions, as the Connect-Maester guide explains.
3. Switch to the app and certificate
I have created an Entra app for Maester with read-only application permissions. Create a certificate for it, give me the public .cer file to upload, and keep the private key as a secret. Then ask me for the tenant ID and client ID using a masked secret request. Never ask me to paste secrets in chat.
The bot then connects the way Maester documents for automation, authenticating within Microsoft Graph and skipping Maester’s own sign-in:
$bytes = [Convert]::FromBase64String($env:MAESTER_CERT_PFX_BASE64)
$cert = [System.Security.Cryptography.X509Certificates.X509Certificate2]::new($bytes)
Connect-MgGraph -AppId $env:MAESTER_CLIENT_ID -Certificate $cert -TenantId $env:MAESTER_TENANT_ID -NoWelcome
Invoke-Maester -SkipGraphConnect -NonInteractive -PassThru -OutputFolder ./maester-results
4. Tell Maester about your tenant
Create a maester-config.json with my emergency access (break glass) account listed under GlobalSettings, EmergencyAccessAccounts. Use breakglass@contoso.com as the placeholder until I give you the real one in a secret. Then run Invoke-Maester -Path ./maester again.
Many Conditional Access tests depend on that setting, and the Getting started guide covers it. Add test exceptions only for decisions you have made, with a reason.
5. Triage the first report
Read the latest Maester JSON results. List the failed tests with severity Critical and High first. For each, give me the test ID, what failed, the business impact in plain English and the fix. Mark anything that looks like a quick win. Don’t apply any fix.
Day-to-day prompts
- Explain a failure: “Explain why MT.1005 failed in our tenant, what an attacker could do with it, and what changes if we fix it.”
- Compare: “Compare this week’s results with the previous run. What newly failed, what was fixed, and what is new because the tests changed?”
- Draft remediation: “Draft step-by-step remediation for the top three failures as a change request I can review. Do not run anything.”
- Focus the run: “Run only the Entra tests with severity Critical or High using -Product entra -Severity Critical, High.”
- Preview a run: “Run with -DryRun -PassThru first and tell me which tests would run.”
- Custom test: “Write a custom Maester test that checks guests cannot invite other guests. Use New-MtTest, follow the first custom test guide, and check it with Get-MtTest before running it.”
For custom tests, the official first custom test guide and the guide to writing a test with AI are worth pointing the bot at. Maester’s own advice is to verify what the AI writes against the Microsoft Learn documentation, and I agree.
Running it regularly
Grok Bot routines are saved prompts that run on a schedule and report back in chat or to channels. Here is the one I would use. The cron expression runs it at 7am Monday, in local time:
0 7 * * 1
Every Monday at 7am Sydney time: use the Maester app secrets to connect with the certificate. Install the pinned Maester version I last approved, and tell me if a newer 3.x version exists but don’t install it. Run Invoke-Maester -SkipGraphConnect -NonInteractive -PassThru -OutputFolder ./maester-results -RedactUserIdentity HtmlOnly. Keep the HTML report. Maester compares the run with the newest earlier results file in that folder, so always use the same folder. Summarise what newly failed, what was fixed and the current counts, then post the summary to the Security channel in Teams. If the run errors out, tell me why instead of posting a partial result.
There are a few reasons for the shape of that prompt. Pinning a version means a new release changes your results only when you choose, which the installation guide recommends for scheduled runs. To approve a new version, use Update-Module Maester and then start a new session, as updating tests describes. In Maester 3 you do not run Update-MaesterTests for that, because it is only for tidying up 2.x copies. Redacting identities in the HTML report is optional but sensible if the report is shared.
If you would rather run it outside Grok Bot, the official monitoring guides cover GitHub Actions (with workload identity federation, which avoids secrets altogether), Azure DevOps and Azure Automation. For GitHub Actions, the docs use maester_major_version: "3" in the Maester action. You can still ask Grok Bot to read the results from those runs.
Troubleshooting
- Module will not load: check
$PSVersionTable.PSVersionis 7.4 or later. - Wrong version running: a leftover 2.x install. Remove it with
Uninstall-Module Maester -MaximumVersion 2.99.99 -AllVersionsand open a new session. - Approval required, or User canceled authentication: an admin has to consent. See the Connect-Maester guide.
- Lots of Skipped: a service is not connected, a module is missing or a permission was not granted. The reason is in the report.
- Pester errors: custom Pester-format tests need Pester 5.7.1 or later.
- Teams webhook or email not arriving: email with app permissions needs
-MailUserId, and the webhook address should be treated as a secret. - Telemetry: Maester sends run events to api.maester.dev unless you add
-DisableTelemetryor setMAESTER_DISABLE_TELEMETRYto 1. Decide what your clients are comfortable with.
The security caveats
The bot only gets read permissions, but the report still contains your tenant’s configuration, so treat it as sensitive. Store the certificate and IDs as secrets, never in chat. Review the report and any remediation before acting, and keep a human in control of every change, as I argued in AI With a Human in Control Beats AI On Its Own.
Wrap-up
Maester 3 is simpler to deploy than 2.x: PowerShell 7.4, one module, no tests folder. Pair it with a bot that can run it every Monday, compare it with last time and explain the diff, and a security check becomes a habit instead of a project. Start with the device code run, move to a certificate when you trust the output, and pin the version.
Sources (checked 30 November 2026)
- Maester installation guide, Getting started, Get the preview, Upgrading from 2.x, Updating tests
- Connect-Maester, Connect-Maester advanced, Invoke-Maester reference, Invoke-Maester configuration, The Maester report
- Email alerts, Teams alerts, Monitoring, First custom test
- Maester 3.0 announcement (7 October 2026)
- Maester on the PowerShell Gallery and Maester releases on GitHub
2 thoughts on “Configuring Maester v3 with Grok Bot: Setup, Prompts and a Weekly Routine”