Public/Invoke-TenantLens.ps1
|
function Invoke-TenantLens { <# .SYNOPSIS All-in-one: snapshot, assessment, report and documentation in one call. .DESCRIPTION Convenience wrapper around Invoke-TenantLensSnapshot, Test-TenantLens, New-TenantLensReport and New-TenantLensDocumentation. findings.json is always written into the run folder. .EXAMPLE Invoke-TenantLens -OutputPath .\out -Report -Documentation #> [CmdletBinding()] param( [Parameter(Mandatory)] [string]$OutputPath, # Collector names to run (default: all). [string[]]$Area, [string]$TenantName, [switch]$Redact, # Write report.html. [switch]$Report, # Write documentation.md. [switch]$Documentation, # Open the report after writing it. [switch]$Open, # Additional rule catalogs (company baselines). [string[]]$RulePath ) $snapshot = Invoke-TenantLensSnapshot -OutputPath $OutputPath -Area $Area -TenantName $TenantName -Redact:$Redact $findings = @(Test-TenantLens -SnapshotPath $snapshot.Path -RulePath $RulePath -OutputPath $snapshot.Path) $reportFile = $null if ($Report) { $reportFile = $findings | New-TenantLensReport -SnapshotPath $snapshot.Path -Open:$Open } $documentationFile = $null if ($Documentation) { $documentationFile = New-TenantLensDocumentation -SnapshotPath $snapshot.Path } [pscustomobject]@{ Path = $snapshot.Path SnapshotPath = $snapshot.SnapshotPath Tenant = $snapshot.Tenant Areas = $snapshot.Areas SkippedAreas = $snapshot.SkippedAreas Findings = $findings ReportPath = $(if ($reportFile) { $reportFile.FullName } else { $null }) DocumentationPath = $(if ($documentationFile) { $documentationFile.FullName } else { $null }) } } |