Merging Results
To create a multi-tenant report, run Maester against each tenant separately, save the JSON output, and merge them with Merge-MtMaesterResult.
PowerShell example
Section titled “PowerShell example”# Run Maester against three tenants and save JSON resultsConnect-MgGraph -TenantId $tenantProductionInvoke-Maester -PassThru -OutputJsonFile ./production.jsonDisconnect-MgGraph
Connect-MgGraph -TenantId $tenantDevelopmentInvoke-Maester -PassThru -OutputJsonFile ./development.jsonDisconnect-MgGraph
Connect-MgGraph -TenantId $tenantChina -Environment ChinaInvoke-Maester -PassThru -OutputJsonFile ./china.jsonDisconnect-MgGraph
# Generate the multi-tenant HTML reportMerge-MtMaesterResult -Path *.json | Get-MtHtmlReport | Out-File ./MultiTenantReport.htmlMerge-MtMaesterResult -Path loads the JSON files, validates them, and merges them into a single multi-tenant result — no manual file loading needed.
Step by step
Section titled “Step by step”-
Connect and run - For each tenant, connect using
Connect-MgGraphwith the tenant ID (and-Environmentfor national clouds), then runInvoke-Maesterwith-OutputJsonFileto save the results as JSON. -
Merge and report - Pass the file paths (or a directory/glob) to
Merge-MtMaesterResult -Path. It loads each JSON file, validates the result structure, and creates a single object with aTenantsarray. Pipe it intoGet-MtHtmlReportto generate the report.
The report automatically detects the multi-tenant format and renders the tenant selector in the sidebar.
Loading results separately with Import-MtMaesterResult
Section titled “Loading results separately with Import-MtMaesterResult”If you need more control, use Import-MtMaesterResult to load the files first, then pipe them into Merge-MtMaesterResult:
Import-MtMaesterResult -Path *.json | Merge-MtMaesterResult | Get-MtHtmlReport | Out-File ./report.htmlImport-MtMaesterResult returns an array of individual result objects. It also auto-expands multi-tenant merged JSON files (files with a Tenants array) back into individual results, so you can re-process previously merged outputs.
National clouds
Section titled “National clouds”When connecting to tenants in national clouds, pass the -Environment parameter to Connect-MgGraph:
| Environment | Cloud |
|---|---|
Global | Microsoft Azure Commercial (default) |
China | Microsoft Azure China (21Vianet) |
USGov | Microsoft Azure US Government (GCC High) |
USGovDoD | Microsoft Azure US Government DoD |
Germany | Microsoft Azure Germany |