diff --git a/PowerShell/ScubaGear/Modules/CreateReport/CreateReport.psm1 b/PowerShell/ScubaGear/Modules/CreateReport/CreateReport.psm1 index 200d936aa..b73b3a95f 100644 --- a/PowerShell/ScubaGear/Modules/CreateReport/CreateReport.psm1 +++ b/PowerShell/ScubaGear/Modules/CreateReport/CreateReport.psm1 @@ -169,7 +169,13 @@ function New-Report { $GroupAnchor = New-MarkdownAnchor -GroupNumber $BaselineGroup.GroupNumber -GroupName $BaselineGroup.GroupName $MarkdownLink = "$Name" $Fragments += $Fragment | ConvertTo-Html -PreContent "

$Number $MarkdownLink

" -Fragment - $ReportJson.Results += $Fragment + + # Package Assessment Report into Report JSON by Policy Group + $ReportJson.Results += [pscustomobject]@{ + GroupName = $BaselineGroup.GroupName; + GroupNumber = $BaselineGroup.GroupNumber; + Controls = $Fragment; + } # Regex will filter out any tags without an id attribute (replace new fragments only, not
tags which have already been modified) $Fragments = $Fragments -replace ".*(]+id)*>)", "
" @@ -178,7 +184,7 @@ function New-Report { # Craft the json report $ReportJson.ReportSummary = $ReportSummary $JsonFileName = Join-Path -Path $IndividualReportPath -ChildPath "$($BaselineName)Report.json" - $ReportJson = ConvertTo-Json @($ReportJson) -Depth 3 + $ReportJson = ConvertTo-Json @($ReportJson) -Depth 5 # ConvertTo-Json for some reason converts the <, >, and ' characters into unicode escape sequences. # Convert those back to ASCII. diff --git a/PowerShell/ScubaGear/Modules/Orchestrator.psm1 b/PowerShell/ScubaGear/Modules/Orchestrator.psm1 index 8a56534be..4b66b5073 100644 --- a/PowerShell/ScubaGear/Modules/Orchestrator.psm1 +++ b/PowerShell/ScubaGear/Modules/Orchestrator.psm1 @@ -823,6 +823,15 @@ function Merge-JsonOutput { $SettingsExport = Get-Content $SettingsExportPath -Raw $TimestampZulu = $(ConvertFrom-Json $SettingsExport).timestamp_zulu + # Get a list and abbreviation mapping of the products assessed + $FullNames = @() + $ProductAbbreviationMapping = @{} + foreach ($ProductName in $ProductNames) { + $BaselineName = $ArgToProd[$ProductName] + $FullNames += $ProdToFullName[$BaselineName] + $ProductAbbreviationMapping[$ProdToFullName[$BaselineName]] = $BaselineName + } + # Extract the metadata $Results = [pscustomobject]@{} $Summary = [pscustomobject]@{} @@ -830,7 +839,9 @@ function Merge-JsonOutput { "TenantId" = $TenantDetails.TenantId; "DisplayName" = $TenantDetails.DisplayName; "DomainName" = $TenantDetails.DomainName; - "Product" = "M365"; + "ProductSuite" = "Microsoft 365"; + "ProductsAssessed" = $FullNames; + "ProductAbbreviationMapping" = $ProductAbbreviationMapping "Tool" = "ScubaGear"; "ToolVersion" = $ModuleVersion; "TimestampZulu" = $TimestampZulu; @@ -844,6 +855,7 @@ function Merge-JsonOutput { $FileName = Join-Path $IndividualReportPath "$($BaselineName)Report.json" $DeletionList += $FileName $IndividualResults = Get-Content $FileName | ConvertFrom-Json + $Results | Add-Member -NotePropertyName $BaselineName ` -NotePropertyValue $IndividualResults.Results @@ -855,8 +867,8 @@ function Merge-JsonOutput { } # Convert the output a json string - $MetaData = ConvertTo-Json $MetaData - $Results = ConvertTo-Json $Results -Depth 3 + $MetaData = ConvertTo-Json $MetaData -Depth 3 + $Results = ConvertTo-Json $Results -Depth 5 $Summary = ConvertTo-Json $Summary -Depth 3 $ReportJson = @" {