-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathBaselineIndex.Doc.ps1
More file actions
95 lines (77 loc) · 3.21 KB
/
BaselineIndex.Doc.ps1
File metadata and controls
95 lines (77 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Document 'index' {
Title 'Baselines'
$metadata = [ordered]@{
generated = 'true'
title = 'Baselines'
}
Metadata $metadata
Import-Module ./out/modules/PSRule.Rules.Azure
$baselines = Get-PSRuleBaseline -Module PSRule.Rules.Azure -WarningAction SilentlyContinue;
Section 'Quarterly baselines' {
'Quarterly baselines provide a quarterly checkpoint of rules.'
Section 'GA' {
'The following baselines relate to generally available Azure features.'
$baselines | Where-Object { $_.Name -like 'Azure.GA_*' } | Sort-Object -Property Name -Descending | Table -Property @{ Name = 'Name'; Expression = {
"[$($_.Name)]($($_.Name).md)"
}}, Synopsis, @{ Name = 'Status'; Expression = {
if ($_.Flags -eq 'None') {
'Latest'
}
else {
$_.Flags.ToString()
}
}}
}
Section 'Preview' {
'The following baselines relate to preview Azure features.'
$baselines | Where-Object { $_.Name -like 'Azure.Preview_*' } | Sort-Object -Property Name -Descending | Table -Property @{ Name = 'Name'; Expression = {
"[$($_.Name)]($($_.Name).md)"
}}, Synopsis, @{ Name = 'Status'; Expression = {
if ($_.Flags -eq 'None') {
'Latest'
}
else {
$_.Flags.ToString()
}
}}
}
}
Section 'Pillar specific baselines' {
'Pillar specific baselines provide a focused set of rules for a specific Azure Well-Architected Pillar.'
$baselines | Where-Object { $_.Name -like 'Azure.Pillar.*' } | Sort-Object -Property Name -Descending | Table -Property @{ Name = 'Name'; Expression = {
"[$($_.Name)]($($_.Name).md)"
}}, Synopsis, @{ Name = 'Status'; Expression = {
if ($_.Flags -eq 'None') {
'Latest'
}
else {
$_.Flags.ToString()
}
}}
}
Section 'Cloud Adoption Framework baselines' {
'Pillar specific baselines provide a focused set of rules that assist with implementing naming and tagging conventions recommended by the Azure Cloud Adoption Framework (CAF).'
$sorted = $baselines | Where-Object { $_.Name -like 'Azure.CAF_*' } | ForEach-Object {
[PSCustomObject]@{
Name = $_.Name
Synopsis = $_.Synopsis
Flags = $_.Flags
Version = $_.Metadata.Annotations.moduleVersion
Priority = if ($_.Name -like '*_Compatibility') { 0 } else { 1 }
}
} | Sort-Object -Property Version,Priority -Descending;
$top = $sorted | Select-Object -First 1;
$sorted | Table -Property @{ Name = 'Name'; Expression = {
"[$($_.Name)]($($_.Name).md)"
}}, Synopsis, @{ Name = 'Status'; Expression = {
if ($_ -eq $top) {
'Latest'
}
else {
'Previous'
}
}}
}
}