Repository navigation
Monitoring using Maester for Configuration drift, get only emails when configuration drifts #449
Replies: 2 comments
|
It also produces a json file as output. You could make a comparison with previous ones to identify configuration drift |
|
Hi @sergioandreslq, building on the JSON output suggestion, the pattern I would use is to treat each run as a snapshot and only notify on a difference between two snapshots. The shape is: run the assessment, save the per test results (test ID and pass/fail) as a small file, load the previous run's file, compare the two, and only call your email step when the list of changed tests is not empty. In GitHub Actions, the previous snapshot can be kept as a workflow artifact or cache, or committed to a private branch so you also get a history of changes for free. Two design points matter more than the tooling. First, compare per test results, not the whole report, because timestamps and counts change every run and would trigger an alert every time. Second, alert on a pass turning into a fail (a regression) separately from a fail turning into a pass, and consider requiring the change to persist for two runs before alerting, so a transient API error does not wake someone up. A rough sketch of the comparison in PowerShell, which I have not run against Maester's output, so check the property names in your own JSON file first: $old = Get-Content ./previous.json | ConvertFrom-Json build a hashtable of TestId -> Result for each file, thenlist the IDs where the Result differs, and send email only if any existAlso note this detects changes in test outcomes, which is a proxy for configuration drift, not a full configuration diff. If you need to see exactly what changed in a policy, you would need a separate export of the configuration itself. |
Uh oh!
There was an error while loading. Please reload this page.
Hello team,
I saw the activity to activate monitoring using GitHub Actions and the email send after run the maester assessment,
the idea is to receive only the email if there is configuration drift in the tenant, do you know if maester is able to compare configuration from yesterday and configuration from today, then, if there is configuration drift notify by email?
best regards,
All reactions