Open tmaestrini opened 3 months ago
First attempt is done βΒ ready for a review: check out the branch '18-report-generation'.
A report can be generated very easily by taking the validation output and feed it into the New-Report
cmdlet. First of all, a markdown file (yyyymmmddHHmm-Report.md
) will be written in ./outputs
directory:
# Validate a given tenant from settings file
Import-Module .\src\Validation.psm1 -Force
$a = Start-Validation -TemplateName "tmaestrini.yml" -ReturnAsObject
New-Report -ValidationResults $a -AsHTML
If you would like to generate an according HTML representation, just add the parameter -As HTML
:
# Validate a given tenant from settings file
Import-Module .\src\Validation.psm1 -Force
$a = Start-Validation -TemplateName "tmaestrini.yml" -ReturnAsObject
New-Report -ValidationResults $a -AsHTML
You're good to go! π
@sympmarc What do you think about this?
@tmaestrini - That's beautiful!
I haven't tried to debug it yet, but I'm getting this error:
Set-LoggingDefaultLevel: The term 'Set-LoggingDefaultLevel' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or
if a path was included, verify that the path is correct and try again.
on the line
$a = Start-Validation -TemplateName "sympraxis.yml" -ReturnAsObject
Hey @sympmarc, glad you've tested it.
I've introduced the Logging module instead of simply printing output to the console.
Does this work?
Ignore that error. Solved!
It looks like I'm getting HTML in the MD file, but it looks great.
New-Report -ValidationResults $a
gives me an MD file containing HTML
New-Report -ValidationResults $a -AsHTML
gives me this error. Think I'm just missing a file.
[2024-04-05 14:41:12-04] [INFO ] Markdown report created: C:\code\Governance\easyGovernace-18-report-generation\easyGovernance\src\Public\Validation......\output/202404051441-Report.md
Convert-MarkdownToHTML: C:\code\Governance\easyGovernace-18-report-generation\easyGovernance\src\Public\Validation\New-Report.ps1:68:24
Line |
68 | $htmlOutput = Convert-MarkdownToHTML $reportFilePath -SiteDi β¦
| ~~~~~~
| The term 'Convert-MarkdownToHTML' is not recognized as a name of a cmdlet, function, script file, or executable
| program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Copy-Item: C:\code\Governance\easyGovernace-18-report-generation\easyGovernance\src\Public\Validation\New-Report.ps1:69:10
Line |
69 | Copy-Item -Path (Join-Path $PSScriptRoot -ChildPath '../../. β¦
| ~~~~~~~~~~~~
| Could not find a part of the path
| 'C:\code\Governance\easyGovernace-18-report-generation\easyGovernance\output\styles\md-styles.css'.
PS C:\code\Governance\easyGovernace-18-report-generation\easyGovernance> [2024-04-05 14:41:12-04] [INFO ] HTML report created:
Needed this module:
Install-Module -Name MarkdownToHTML
(as you know!)
FYI - the settings_template.yml
file doesn't match the baselines available in \easyGovernance\baselines
FYI - the
settings_template.yml
file doesn't match the baselines available in \easyGovernance\baselines
Thanks for this. Didn't have it on the radar. Will fix it asap. πͺπͺπͺ
Needed this module:
Install-Module -Name MarkdownToHTML
(as you know!)
I should add this Module as dependencies. Sorry for the poor communication on my part.
No worries. All part of testing.
Looks like you're also missing a validation ps1 for M365.IAM-1-2.1.yml
.
Does the mix of MD and HTML cause distraction? If it does, we could tidy up an generate "pure" MD and write an adapter for the HTML content.
For now, it certainly works. It's nice-looking output. Technically, it's not markdown.
Yes, you're right. I think we should tidy it up. It's still work in progress.
But over all - do you like the "content" and the style of the presentation? I mean over all: are we facing the right direction?
Absolutely. The output looks good and is suitable to put into a PowerPoint or to share with management.
Hey @tmaestrini do you consider supporting other report types? I explain which and why
That's a great idea, @Adam-it . We will work it out and let you know. Thanks for your contribution, you're a π
To get a proper overview over the services within the tenant, a function to generate a validation report (Markdown) should be implemented.