2020-06-21 11:14:32 +03:00
|
|
|
# Copyright (c) Microsoft Corporation.
|
|
|
|
# Licensed under the MIT License.
|
|
|
|
|
2021-09-11 09:40:29 +03:00
|
|
|
Export-PSDocumentConvention 'NameBaseline' -Process {
|
|
|
|
$PSDocs.Document.InstanceName = $PSDocs.TargetObject.Name;
|
|
|
|
}
|
|
|
|
|
2023-02-11 06:34:05 +03:00
|
|
|
Document 'baseline' -If { $PSDocs.TargetObject.Name -ne 'Azure.MCSB.v1' } {
|
2021-09-11 09:40:29 +03:00
|
|
|
$baselineName = $PSDocs.TargetObject.Name;
|
|
|
|
$obsolete = $PSDocs.TargetObject.metadata.annotations.obsolete -eq $True;
|
|
|
|
|
|
|
|
Write-Verbose -Message "[Baseline] -- Processing baseline: $baselineName";
|
|
|
|
Write-Verbose -Message "[Baseline] -- Baseline is obsolete: $obsolete";
|
2020-06-21 11:14:32 +03:00
|
|
|
|
|
|
|
Title $baselineName;
|
|
|
|
|
2024-03-10 21:10:51 +03:00
|
|
|
Metadata $PSDocs.TargetObject.metadata.annotations
|
|
|
|
|
2020-09-19 12:16:45 +03:00
|
|
|
if ($obsolete) {
|
2021-09-18 09:23:07 +03:00
|
|
|
'<!-- OBSOLETE -->'
|
2020-09-19 12:16:45 +03:00
|
|
|
}
|
|
|
|
|
2023-11-30 21:48:34 +03:00
|
|
|
$rules = $PSDocs.TargetObject.Rules | Sort-Object -Property Name;
|
2020-06-21 11:14:32 +03:00
|
|
|
$ruleCount = $rules.Length;
|
|
|
|
|
2021-09-11 09:40:29 +03:00
|
|
|
$PSDocs.TargetObject.Synopsis;
|
2020-06-21 11:14:32 +03:00
|
|
|
|
2021-09-11 09:40:29 +03:00
|
|
|
Write-Verbose -Message "[Baseline] -- Found $ruleCount rules.";
|
2020-06-21 11:14:32 +03:00
|
|
|
|
2021-09-11 09:40:29 +03:00
|
|
|
Section 'Rules' -If { $ruleCount -gt 0 } {
|
2024-03-11 06:46:30 +03:00
|
|
|
"The following rules are included within the ``$baselineName`` baseline.";
|
|
|
|
"This baseline includes a total of $ruleCount rules.";
|
2021-09-11 09:40:29 +03:00
|
|
|
$rules | Table -Property @{ Name = 'Name'; Expression = {
|
2023-11-30 21:48:34 +03:00
|
|
|
"[$($_.Name)](../rules/$($_.Name).md)"
|
2020-06-21 11:14:32 +03:00
|
|
|
}}, Synopsis, @{ Name = 'Severity'; Expression = {
|
|
|
|
$_.Info.Annotations.severity
|
|
|
|
}}
|
|
|
|
}
|
|
|
|
}
|
2023-02-11 06:34:05 +03:00
|
|
|
|
2024-03-03 14:57:02 +03:00
|
|
|
Document 'Azure.MCSB.Baseline' -If { $PSDocs.TargetObject.Name -eq 'Azure.MCSB.v1' } {
|
2023-02-11 06:34:05 +03:00
|
|
|
$baselineName = $PSDocs.TargetObject.Name;
|
|
|
|
$obsolete = $PSDocs.TargetObject.metadata.annotations.obsolete -eq $True;
|
2023-02-19 12:34:57 +03:00
|
|
|
$experimental = $PSDocs.TargetObject.metadata.annotations.experimental -eq $True;
|
2023-02-11 06:34:05 +03:00
|
|
|
|
|
|
|
Write-Verbose -Message "[Baseline] -- Processing baseline: $baselineName";
|
|
|
|
Write-Verbose -Message "[Baseline] -- Baseline is obsolete: $obsolete";
|
2023-02-19 12:34:57 +03:00
|
|
|
Write-Verbose -Message "[Baseline] -- Baseline is experimental: $experimental";
|
2023-02-11 06:34:05 +03:00
|
|
|
|
|
|
|
Title $baselineName;
|
|
|
|
|
2024-03-10 21:10:51 +03:00
|
|
|
Metadata $PSDocs.TargetObject.metadata.annotations
|
|
|
|
|
2023-02-19 12:34:57 +03:00
|
|
|
if ($experimental) {
|
|
|
|
'<!-- EXPERIMENTAL -->'
|
|
|
|
}
|
|
|
|
|
2023-02-11 06:34:05 +03:00
|
|
|
if ($obsolete) {
|
|
|
|
'<!-- OBSOLETE -->'
|
|
|
|
}
|
|
|
|
|
2023-11-30 21:48:34 +03:00
|
|
|
$rules = $PSDocs.TargetObject.Rules | Sort-Object -Property Name;
|
2023-02-11 06:34:05 +03:00
|
|
|
$ruleCount = $rules.Length;
|
|
|
|
|
|
|
|
$PSDocs.TargetObject.Synopsis;
|
|
|
|
|
|
|
|
Write-Verbose -Message "[Baseline] -- Found $ruleCount rules.";
|
|
|
|
|
|
|
|
Section 'Controls' -If { $ruleCount -gt 0 } {
|
2024-03-11 06:46:30 +03:00
|
|
|
"The following rules are included within the ``$baselineName`` baseline.";
|
|
|
|
"This baseline includes a total of $ruleCount rules.";
|
2023-02-11 06:34:05 +03:00
|
|
|
$rules | Table -Property @{ Name = 'Name'; Expression = {
|
2023-11-30 21:48:34 +03:00
|
|
|
"[$($_.Name)](../rules/$($_.Name).md)"
|
2023-02-11 06:34:05 +03:00
|
|
|
}}, Synopsis, @{ Name = 'Severity'; Expression = {
|
|
|
|
$_.Info.Annotations.severity
|
|
|
|
}}
|
|
|
|
}
|
|
|
|
}
|