@@ -13,15 +13,24 @@ function Invoke-CippTestGenericTest011 {
1313 return
1414 }
1515
16- # Load standards.json for friendly name resolution
16+ # Load standards.json for friendly name and compliance-tag resolution
1717 $StandardsLabelMap = @ {}
18+ $StandardsTagMap = @ {}
1819 $StandardsJsonPath = Join-Path $env: CIPPRootPath ' Config\standards.json'
1920 if (Test-Path $StandardsJsonPath ) {
2021 $StandardsJson = Get-Content $StandardsJsonPath - Raw | ConvertFrom-Json
2122 foreach ($Std in $StandardsJson ) {
2223 if ($Std.name -and $Std.label ) {
2324 $StandardsLabelMap [$Std.name ] = $Std.label
2425 }
26+ if ($Std.name -and $Std.tag ) {
27+ # Keep human-readable compliance-framework references (CIS, NIST, etc. - they
28+ # contain spaces) and drop internal single-token tags like 'mip_search_auditlog'.
29+ $FrameworkTags = @ ($Std.tag | Where-Object { $_ -is [string ] -and $_ -match ' \s' })
30+ if ($FrameworkTags.Count -gt 0 ) {
31+ $StandardsTagMap [$Std.name ] = ($FrameworkTags -join ' , ' )
32+ }
33+ }
2534 }
2635 }
2736
@@ -130,6 +139,26 @@ function Invoke-CippTestGenericTest011 {
130139 return $null
131140 }
132141
142+ # Helper: resolve a standard's compliance-framework tags (CIS/NIST/etc.). Template-based
143+ # standards (Intune/CA/Quarantine) have no standards.json entry, so they return empty.
144+ $ResolveTags = {
145+ param ($StandardName )
146+ if ([string ]::IsNullOrWhiteSpace($StandardName )) { return ' ' }
147+ if ($StandardsTagMap.ContainsKey ($StandardName )) { return $StandardsTagMap [$StandardName ] }
148+ return ' '
149+ }
150+
151+ # Helper: render a stored CurrentValue/ExpectedValue (plain string, bool, or compact JSON)
152+ # safely inside a markdown table cell - escape pipes, collapse newlines, and truncate blobs.
153+ $FormatValue = {
154+ param ($Value )
155+ if ($null -eq $Value -or " $Value " -eq ' ' ) { return ' ' }
156+ $Text = [string ]$Value
157+ $Text = $Text -replace ' \|' , ' \|' -replace ' \r?\n' , ' '
158+ if ($Text.Length -gt 300 ) { $Text = $Text.Substring (0 , 297 ) + ' ...' }
159+ return $Text
160+ }
161+
133162 foreach ($Template in $AlignmentItems ) {
134163 $TemplateName = $Template.StandardName
135164 $Score = $Template.AlignmentScore
@@ -168,24 +197,32 @@ function Invoke-CippTestGenericTest011 {
168197
169198 # Compliant items
170199 if ($CompliantItems.Count -gt 0 ) {
171- $null = $Result.Append (" | Standard | Status |`n " )
172- $null = $Result.Append (" |----------|--------|`n " )
200+ $null = $Result.Append (" #### Compliant Standards`n`n " )
201+ $null = $Result.Append (" | Standard | Tags | Status |`n " )
202+ $null = $Result.Append (" |----------|------|--------|`n " )
173203 foreach ($Item in $CompliantItems ) {
174204 $FriendlyName = & $ResolveDisplayName $Item.StandardName $TemplateSettings
175205 if (-not $FriendlyName ) { continue }
176- $null = $Result.Append (" | $FriendlyName | ✅ Compliant |`n " )
206+ $Tags = & $ResolveTags $Item.StandardName
207+ $null = $Result.Append (" | $FriendlyName | $Tags | ✅ Compliant |`n " )
177208 }
178209 $null = $Result.Append (" `n " )
179210 }
180211
181- # Non-compliant items
212+ # Non-compliant items — include the compliance tags and the reason for failure
213+ # (expected value from the standard vs. the current config on the tenant).
182214 if ($NonCompliantItems.Count -gt 0 ) {
183- $null = $Result.Append (" | Standard | Status |`n " )
184- $null = $Result.Append (" |----------|--------|`n " )
215+ $null = $Result.Append (" #### Non-Compliant Standards`n`n " )
216+ $null = $Result.Append (" | Standard | Tags | Expected Value | Current Value (on tenant) |`n " )
217+ $null = $Result.Append (" |----------|------|----------------|---------------------------|`n " )
185218 foreach ($Item in $NonCompliantItems ) {
186219 $FriendlyName = & $ResolveDisplayName $Item.StandardName $TemplateSettings
187220 if (-not $FriendlyName ) { continue }
188- $null = $Result.Append (" | $FriendlyName | ❌ Non-Compliant |`n " )
221+ $Tags = & $ResolveTags $Item.StandardName
222+ $Expected = & $FormatValue $Item.ExpectedValue
223+ $Current = & $FormatValue $Item.CurrentValue
224+ if (-not $Current ) { $Current = ' _Not configured / no data_' }
225+ $null = $Result.Append (" | $FriendlyName | $Tags | $Expected | $Current |`n " )
189226 }
190227 $null = $Result.Append (" `n " )
191228 }
@@ -194,25 +231,27 @@ function Invoke-CippTestGenericTest011 {
194231 if ($LicenseMissingItems.Count -gt 0 ) {
195232 $null = $Result.Append (" #### Standards Not Applied Due to Missing Licenses`n`n " )
196233 $null = $Result.Append (" These items are part of this baseline, but your environment does not meet the minimum required licenses for them to be applied.`n`n " )
197- $null = $Result.Append (" | Standard | Status |`n " )
198- $null = $Result.Append (" |----------|--------|`n " )
234+ $null = $Result.Append (" | Standard | Tags | Status |`n " )
235+ $null = $Result.Append (" |----------|------|------ --|`n " )
199236 foreach ($Item in $LicenseMissingItems ) {
200237 $FriendlyName = & $ResolveDisplayName $Item.StandardName $TemplateSettings
201238 if (-not $FriendlyName ) { continue }
202- $null = $Result.Append (" | $FriendlyName | ⚠️ License Missing |`n " )
239+ $Tags = & $ResolveTags $Item.StandardName
240+ $null = $Result.Append (" | $FriendlyName | $Tags | ⚠️ License Missing |`n " )
203241 }
204242 $null = $Result.Append (" `n " )
205243 }
206244
207245 # Reporting disabled items
208246 if ($ReportingDisabledItems.Count -gt 0 ) {
209247 $null = $Result.Append (" #### Standards With Reporting Disabled`n`n " )
210- $null = $Result.Append (" | Standard | Status |`n " )
211- $null = $Result.Append (" |----------|--------|`n " )
248+ $null = $Result.Append (" | Standard | Tags | Status |`n " )
249+ $null = $Result.Append (" |----------|------|------ --|`n " )
212250 foreach ($Item in $ReportingDisabledItems ) {
213251 $FriendlyName = & $ResolveDisplayName $Item.StandardName $TemplateSettings
214252 if (-not $FriendlyName ) { continue }
215- $null = $Result.Append (" | $FriendlyName | ⏸️ Reporting Disabled |`n " )
253+ $Tags = & $ResolveTags $Item.StandardName
254+ $null = $Result.Append (" | $FriendlyName | $Tags | ⏸️ Reporting Disabled |`n " )
216255 }
217256 $null = $Result.Append (" `n " )
218257 }
0 commit comments