Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI Environment] Add scheduled workflow to validate PSRule pre-flight checks on the whole library #2453

Merged
merged 164 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from 160 commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
173e72c
linter
eriqua Sep 19, 2022
a4b0c10
Create ps-rule.yaml (#2066)
elbatane Sep 19, 2022
9db67f6
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule
eriqua Sep 19, 2022
dc031fc
exclude parameters
eriqua Sep 19, 2022
b1533f1
[Hackaton] First test for PSRule exclusions on KeyVault (#2067)
kareldewinter Sep 19, 2022
c71f513
[Hackathon] Token replacement for the resource group module (#2068)
elbatane Sep 19, 2022
d16203b
merge main
eriqua Sep 19, 2022
9a0a600
pathIgnore
eriqua Sep 19, 2022
9cc1d1f
[Hackathon] PSRule addition for VNet resource (#2070)
karthikvenkat17 Sep 20, 2022
893bd8f
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule
eriqua Sep 20, 2022
855f161
clean up token replacement
eriqua Sep 20, 2022
81b5a9f
clean up token replacement further
eriqua Sep 20, 2022
7aa8000
resize token replacement
eriqua Sep 20, 2022
f10a381
[Hackathon] Added suppression group for dependency resources (#2071)
karthikvenkat17 Sep 20, 2022
15ceeaa
typo
eriqua Sep 20, 2022
5dc4099
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule
eriqua Sep 20, 2022
153fad8
modulePath
eriqua Sep 20, 2022
c0ed856
job name
eriqua Sep 20, 2022
dea25f8
no psrule
eriqua Sep 20, 2022
d2a89d8
no psrule step
eriqua Sep 20, 2022
19cfe71
fix inputpath
eriqua Sep 20, 2022
20e405b
comment out continue on error option
eriqua Sep 20, 2022
4a07c2a
Align KV
eriqua Sep 20, 2022
589d704
kv no psrule
eriqua Sep 20, 2022
0b6c7ad
replace
eriqua Sep 20, 2022
393bfb5
no replace
eriqua Sep 20, 2022
16fab36
replace 1
eriqua Sep 20, 2022
75f8b6c
indent
eriqua Sep 20, 2022
5c417db
align vnet
eriqua Sep 20, 2022
09a730f
align vnet and enable deployment
eriqua Sep 20, 2022
04924d5
[Hackaton] Align 3 module workflows to use PSRule test matrix (#2065)
eriqua Sep 20, 2022
5253723
notProcessedWarning
eriqua Sep 20, 2022
f7e7ae6
conflicts
eriqua Sep 20, 2022
3a260c9
suppressedRuleWarning
eriqua Sep 20, 2022
5c737f1
[Hackathon] PSRule output in markdown (#2072)
karthikvenkat17 Sep 20, 2022
0b237e6
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Sep 20, 2022
00e2515
enable deployment
eriqua Sep 20, 2022
b9c0b5a
[Hackaton] Psrule output on csv format with detailed results (#2089)
elanzel Sep 21, 2022
3793b44
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Sep 21, 2022
f16b432
[Hackaton] csv output on Keyvault module (#2091)
elanzel Sep 21, 2022
16971bd
[Hackathon] Set PSRule output script (#2093)
elbatane Sep 21, 2022
01b4772
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Sep 21, 2022
0dda740
linter csv
eriqua Sep 21, 2022
5917a86
path to ignore
eriqua Sep 21, 2022
729a9c6
execution
eriqua Sep 21, 2022
c19be04
disable rg deployment
eriqua Sep 21, 2022
8e26711
2 jobs
eriqua Sep 21, 2022
0d6d1d1
inputpath
eriqua Sep 21, 2022
d922050
add init
eriqua Sep 21, 2022
289e5a1
variables
eriqua Sep 21, 2022
18b729a
env variables
eriqua Sep 21, 2022
c2c1961
call function
eriqua Sep 21, 2022
0f7848d
md detail summary
eriqua Sep 21, 2022
393c348
new lines
eriqua Sep 21, 2022
6cf317b
details pass and fail
eriqua Sep 21, 2022
d930a7a
moduleTestFiles
eriqua Sep 21, 2022
bc45398
moduleTest
eriqua Sep 21, 2022
ddd803f
join path
eriqua Sep 21, 2022
6a87be4
modulesFolderPath
eriqua Sep 21, 2022
72d7987
modulesFolderPath collection
eriqua Sep 21, 2022
f674dcc
modulesFolderPath no filter
eriqua Sep 21, 2022
a84b424
modulesFolderPath no file
eriqua Sep 21, 2022
057a4c2
force
eriqua Sep 21, 2022
a60f695
cleanup
eriqua Sep 21, 2022
a62af96
root
eriqua Sep 21, 2022
3baec7b
noroot
eriqua Sep 21, 2022
de1233e
convert verbose
eriqua Sep 21, 2022
21e5a32
no pipe
eriqua Sep 21, 2022
bca177c
[Hackaton] Added PSRule Output to job summary (#2110)
elanzel Sep 22, 2022
f7fd0c4
[Hackaton] Hack/topic6 virtual network PSrule on GitHub Action (#2111)
fabmas Sep 22, 2022
da2a9de
[Hackaton] Fix job summary output in GH action (#2112)
eriqua Sep 22, 2022
f4c8e31
[hackaton]: Hack/topic6 fabmas/psrule test updated RG, KV, VNET (#2113)
fabmas Sep 22, 2022
4e994d8
[Hackathon] Suppress rules where not required (#2115)
karthikvenkat17 Sep 22, 2022
8dff446
merge dev
eriqua Sep 22, 2022
df43f6b
[Hackathon] Added psrule to ado pipelines (#2121)
kareldewinter Sep 23, 2022
bf99641
[Hackathon] Refined PSRule results, uncommented Deploy and Publish jo…
elbatane Sep 23, 2022
1ccf62e
Merge branch 'main' into hack/topic6
eriqua Sep 29, 2022
40c8484
merge dev
eriqua Sep 29, 2022
89f3a24
yay
eriqua Sep 29, 2022
e3324dd
token secret
eriqua Sep 29, 2022
084b06a
skip passed
eriqua Sep 29, 2022
a53defe
rocket
eriqua Sep 29, 2022
658b2c4
noFailuresContent
eriqua Sep 29, 2022
de2c95b
yay Content
eriqua Sep 29, 2022
a3c9628
yay Content if the case
eriqua Sep 29, 2022
6dd8b88
double rocket
eriqua Sep 29, 2022
cadcdb1
cleanup
eriqua Sep 29, 2022
085750d
header content
eriqua Sep 29, 2022
5bbc4e2
header
eriqua Sep 29, 2022
f463007
cleanup
eriqua Sep 29, 2022
e341836
cleanerup
eriqua Sep 29, 2022
86aa6b9
tbd
eriqua Sep 29, 2022
ff97996
Merge branch 'main' into hack/topic6
eriqua Oct 3, 2022
29b3f2e
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Oct 3, 2022
d07aae6
test on kv only
eriqua Oct 4, 2022
4121f34
test on kv only change
eriqua Oct 4, 2022
950c542
test on kv only change path
eriqua Oct 4, 2022
d204934
library
eriqua Oct 4, 2022
361905e
comment
eriqua Oct 4, 2022
5314f91
Merge branch 'main' into hack/topic6
eriqua Oct 4, 2022
e07bf7b
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Oct 4, 2022
cfeab87
Merge branch 'main' into hack/topic6
eriqua Oct 10, 2022
c4c2f8d
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Oct 10, 2022
ffb3363
suppress ms rg
eriqua Oct 10, 2022
6bca85c
suppress privatelink
eriqua Oct 10, 2022
a8fc308
Merge branch 'main' into hack/topic6
eriqua Oct 12, 2022
6b5241c
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Oct 12, 2022
4fabf3a
reduce scope
eriqua Oct 12, 2022
9d874c0
reduce scope csv
eriqua Oct 12, 2022
8105f81
reduce scope csv kv
eriqua Oct 12, 2022
f9b826f
242
eriqua Oct 12, 2022
69fa379
remove require
eriqua Oct 12, 2022
c60eb48
250
eriqua Oct 12, 2022
ac2a193
250 linter
eriqua Oct 12, 2022
4126873
240 linter
eriqua Oct 12, 2022
fba2d2c
requires 240 linter
eriqua Oct 12, 2022
3bbee13
include 240
eriqua Oct 12, 2022
31f468d
Merge branch 'main' into hack/topic6
eriqua Oct 14, 2022
dd834df
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Oct 14, 2022
27fb27a
Merge branch 'main' into hack/topic6
eriqua Oct 18, 2022
953c8ad
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Oct 18, 2022
a56cd66
EoF
eriqua Oct 18, 2022
cc6968e
update inputpath to all modules
eriqua Oct 18, 2022
12022e6
Merge branch 'main' into hack/topic6
eriqua Nov 8, 2022
d8e8b13
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Nov 8, 2022
728ec27
Merge branch 'main' into hack/topic6
eriqua Dec 9, 2022
585febb
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Dec 9, 2022
aaeb0f7
[Hackaton] Update PSRule suppress rules (#2451)
eriqua Dec 13, 2022
5238df1
Merge branch 'main' into hack/topic6
eriqua Dec 13, 2022
baef68b
Merge branch 'hack/topic6' into hack/topic6-erikag/test-psrule-linter
eriqua Dec 13, 2022
e444749
clean psrule settings
eriqua Dec 13, 2022
23f1be1
pipeline trigger
eriqua Dec 13, 2022
1a4dcdc
scheduled pipeline
eriqua Dec 13, 2022
80df859
linter cleanup
eriqua Dec 13, 2022
c572528
update workflow
eriqua Dec 13, 2022
c913168
remove actions and templates
eriqua Dec 13, 2022
53cc4ac
cleanup module pipelines
eriqua Dec 13, 2022
96cc459
typo
eriqua Dec 13, 2022
22c74f3
main settings cleanup
eriqua Dec 13, 2022
0318422
update trigger
eriqua Dec 13, 2022
699604b
update trigger
eriqua Dec 13, 2022
ea56024
Merge branch 'main' into users/erikag/psrule-check-onschedule
eriqua Jan 15, 2023
f49932b
docs
eriqua Jan 15, 2023
f00e1d4
remove branch push
eriqua Jan 15, 2023
20aab71
Update docs/wiki/The CI environment - Pipeline design.md
eriqua Jan 16, 2023
7e3d2a4
Update .github/workflows/platform.librarycheck.psrule.yml
eriqua Jan 16, 2023
4af74b7
Update utilities/pipelines/PSRuleValidation/Set-PSRuleOutput.ps1
eriqua Jan 16, 2023
5351bad
Update utilities/pipelines/PSRuleValidation/Set-PSRuleOutput.ps1
eriqua Jan 16, 2023
9ed2269
Update utilities/pipelines/PSRuleValidation/Set-PSRuleOutput.ps1
eriqua Jan 16, 2023
96c8c33
Update utilities/pipelines/PSRuleValidation/Set-PSRuleOutput.ps1
eriqua Jan 16, 2023
047feae
Update utilities/pipelines/PSRuleValidation/Set-PSRuleOutput.ps1
eriqua Jan 16, 2023
33d5776
Update utilities/pipelines/PSRuleValidation/Set-PSRuleOutput.ps1
eriqua Jan 16, 2023
0395217
Update utilities/pipelines/PSRuleValidation/Set-PSRuleOutput.ps1
eriqua Jan 16, 2023
0cf84d2
Update utilities/pipelines/PSRuleValidation/Set-PSRuleOutput.ps1
eriqua Jan 16, 2023
272469a
update comment
eriqua Jan 16, 2023
486d7d5
Merge branch 'users/erikag/psrule-check-onschedule' of https://github…
eriqua Jan 16, 2023
5b89b7a
Update docs/wiki/The CI environment - Pipeline design.md
eriqua Jan 16, 2023
3f260fb
update wiki
eriqua Jan 16, 2023
a149f56
function name
eriqua Jan 16, 2023
ce27d31
test on push
eriqua Jan 16, 2023
19fd445
fix typo
eriqua Jan 16, 2023
0ceb81d
format resource name
eriqua Jan 16, 2023
7acd933
gh env
eriqua Jan 16, 2023
b11de3e
removed test branch from trigger
eriqua Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/platform.librarycheck.psrule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: '.Platform: Library PSRule pre-flight validation'
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_dispatch:
schedule:
- cron: '0 12 * * 0' # Weekly Sunday Analysis
push:
branches:
- users/erikag/psrule-check-onschedule


env:
variablesPath: 'settings.yml'
modulesPath: 'modules'
TOKEN_NAMEPREFIX: '${{ secrets.TOKEN_NAMEPREFIX }}'

jobs:
psrule:
name: PSRule
runs-on: ubuntu-20.04
steps:
# Analyze module library with PSRule
- name: Checkout
uses: actions/checkout@v3
- name: Set environment variables
uses: ./.github/actions/templates/setEnvironmentVariables
with:
variablesPath: ${{ env.variablesPath }}
- name: 'Replace tokens in template file'
uses: azure/powershell@v1
with:
azPSVersion: 'latest'
inlineScript: |
# Grouping task logs
Write-Output '::group::Replace tokens in template file'

# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'pipelines' 'tokensReplacement' 'Convert-TokensInFileList.ps1')

# Populate tokens
$Tokens = @{
subscriptionId = '${{ secrets.ARM_SUBSCRIPTION_ID }}'
managementGroupId = '${{ secrets.ARM_MGMTGROUP_ID }}'
tenantId = '${{ env.ARM_TENANT_ID }}'
}

## Add local (source control) tokens
$tokenMap = @{}
foreach ($token in (Get-ChildItem env: | Where-Object -Property Name -Like "localToken_*")) {
$tokenMap += @{ $token.Name.Replace('localToken_','','OrdinalIgnoreCase') = $token.value }
}
Write-Verbose ('Using local tokens [{0}]' -f ($tokenMap.Keys -join ', ')) -Verbose
$Tokens += $tokenMap

## Swap 'namePrefix' token if empty and provided as a GitHub secret
if([String]::IsNullOrEmpty($Tokens['namePrefix'])){
Write-Verbose 'Using [namePrefix] token from GitHub' -Verbose
$Tokens['namePrefix'] = '${{ env.TOKEN_NAMEPREFIX }}'
}

# Get File Path List
$modulesFolderPath = Join-Path $env:GITHUB_WORKSPACE '${{ env.modulesPath }}'
$moduleTestFiles = [System.Collections.ArrayList]@()
$moduleTestFiles += Get-ChildItem -Path $env:GITHUB_WORKSPACE -Filter *.test.bicep -Recurse -Force -Name

# Construct Token Function Input
$ConvertTokensInputs = @{
FilePathList = $moduleTestFiles
Tokens = $Tokens
TokenPrefix = '${{ env.tokenPrefix }}'
TokenSuffix = '${{ env.tokenSuffix }}'
}

Write-Verbose "Convert Tokens Input:`n $($ConvertTokensInputs | ConvertTo-Json -Depth 10)" -Verbose

# Invoke Token Replacement Functionality [For Module]
$null = Convert-TokensInFileList @ConvertTokensInputs -verbose

Write-Output '::endgroup::'
- name: Run PSRule analysis
uses: microsoft/ps-rule@v2.4.0
continue-on-error: true # Setting this whilst PSRule gets bedded in, in this project
with:
modules: 'PSRule.Rules.Azure'
inputPath: '${{ env.modulesPath }}/'
outputFormat: Csv
outputPath: '${{ env.modulesPath }}/PSRule-output.csv'
- name: 'Parse CSV content'
uses: azure/powershell@v1
with:
azPSVersion: 'latest'
inlineScript: |
# Grouping task logs
Write-Output '::group::Parse CSV content'

# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'pipelines' 'PSRuleValidation' 'Set-PSRuleGitHubOutput.ps1')

# Populate parameter input
$ParameterInput = @{
inputFilePath = '${{ env.modulesPath }}/PSRule-output.csv'
outputFilePath = '${{ env.modulesPath }}/PSRule-output.md'
skipPassedRulesReport = $true
}

# Invoke function
$null = Set-PSRuleGitHubOutput @ParameterInput

Write-Output '::endgroup::'
- name: Output to GitHub job summaries
if: always()
run: Get-Content '${{ env.modulesPath }}/PSRule-output.md' >> $GITHUB_STEP_SUMMARY
13 changes: 13 additions & 0 deletions .ps-rule/dep-suppress.Rule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved
# Synopsis: Suppress Rules for dependencies
apiVersion: github.com/microsoft/PSRule/v1
kind: SuppressionGroup
metadata:
name: 'SuppressDependency'
spec:
if:
name: '.'
startsWith:
- 'dep'
- 'ms.'
- 'privatelink.'
15 changes: 15 additions & 0 deletions .ps-rule/min-suppress.Rule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# Synopsis: Suppress Rules for min tests
apiVersion: github.com/microsoft/PSRule/v1
kind: SuppressionGroup
metadata:
name: 'SuppressMin'
spec:
rule:
- Azure.Resource.UseTags
- Azure.KeyVault.Logs
if:
name: '.'
contains:
- 'min'

47 changes: 47 additions & 0 deletions docs/wiki/The CI environment - Pipeline design.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This section provides an overview of the design principles applied to the CARML
- [Platform pipelines](#platform-pipelines)
- [ReadMe pipeline](#readme-pipeline)
- [Wiki pipeline](#wiki-pipeline)
- [PSRule Pre-Flight validation pipeline](#psrule-pre-flight-validation-pipeline)

---

Expand Down Expand Up @@ -105,6 +106,7 @@ In addition to module pipelines, the repository includes several platform pipeli

- [ReadMe pipeline](#readme-pipeline)
- [Wiki pipeline](#wiki-pipeline)
- [PSRule Pre-Flight validation pipeline](#psrule-pre-flight-validation-pipeline)

## ReadMe pipeline

Expand All @@ -121,3 +123,48 @@ Once triggered, the pipeline crawls through the library and updates the tables i
The purpose of the wiki pipeline is to sync any files from the `docs/wiki` folder to the wiki repository. It is triggered each time changes are pushed to the `main` branch and only if files in the `docs/wiki` folder are altered.

> **Note:** Any changes performed directly on the wiki via the UI will be overwritten by this pipeline.

## PSRule Pre-Flight validation pipeline

The purpose of the PSRule Pre-Flight validation pipeline is to validate Azure resources deployed by module validation pipeline tests, by leveraging [PSRule for Azure](https://azure.github.io/PSRule.Rules.Azure/about/).
PSRule for Azure is aligned to the [Well-Architected Framework (WAF)](https://learn.microsoft.com/en-us/azure/architecture/framework/). Tests, called _Rules_, check the configuration of Azure resources against WAF principles.

The pipeline, currently only available as a [GitHub workflow](https://github.com/Azure/ResourceModules/blob/main/.github/workflows/platform.librarycheck.psrule.yml), runs weekly on the whole library, providing as output the list of non-compliant resources and corresponding failing rules, if any.

### Configuration settings

PSRule options set for the CARML repository are configured in the [ps-rule.yaml](https://github.com/Azure/ResourceModules/blob/main/ps-rule.yaml) file.

Documentation for all configuration options is available at the following links:
- https://aka.ms/ps-rule/options
- https://aka.ms/ps-rule-azure/options

### Baselines

A [baseline](https://azure.github.io/PSRule.Rules.Azure/working-with-baselines/) is a standard PSRule artifact that combines rules and configuration. The PSRule Pre-Flight validation pipeline uses the default baseline to analyze module test resources.

For the list of all rules included see [Azure.Default baseline](https://azure.github.io/PSRule.Rules.Azure/en/baselines/Azure.Default/).
To view a list of rules by Azure resources see [Rules by resource](https://azure.github.io/PSRule.Rules.Azure/en/rules/resource/).

### Exclusions and suppression rules

Not all baseline rules may be valid for some of the test Azure resources deployed by the module validation pipelines.

For example, resources deployed by the min tests, aim to validate only the required input parameters for each module.
Therefore, optional features such as diagnostic settings are not configured in those tests. Since enabling logging is a general recommendation for most of the resources supporting them, missing diagnostic settings usually trigger incopliance of PSRule checks, e.g., [Azure.KeyVault.Logs](https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.KeyVault.Logs/). For this reason, these checks are excluded from being evaluated for resources deployed by min tests.

PSRule allows skipping rules on two levels:

- **Exclusions**: Can be leveraged to exclude specific baseline rules from being evaluated for any resource.
- [ps-rule.yaml](https://github.com/Azure/ResourceModules/blob/main/ps-rule.yaml): Lists the name of specific rules to exclude under the option [Rule.Exclude](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Options/#ruleexclude)
- **Suppression Groups**: PSRule can use [Suppression Groups](https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_SuppressionGroups/) to suppress rules based on a condition. Suppression groups can be leveraged when some of the rules in the baseline are not relevant under specific conditions, e.g., only for specific resources. They are stored in the `.ps-rule` repo root folder in `.yaml` format. In particular:
- [.ps-rule\dep-suppress.Rule.yaml](https://github.com/Azure/ResourceModules/blob/main/.ps-rule/dep-suppress.Rule.yaml): Lists rules to be ignored for resources deployed as dependencies
- [.ps-rule\min-suppress.Rule.yaml](https://github.com/Azure/ResourceModules/blob/main/.ps-rule/min-suppress.Rule.yaml): Lists rules to be ignored for resources deployed by the min tests

### Output

To better outline failed rules and allow fixing incompliant resources quickly, the pipeline leverages the script [utilities\pipelines\PSRuleValidation\Set-PSRuleGitHubOutput.ps1](https://github.com/Azure/ResourceModules/blob/main/utilities/pipelines/PSRuleValidation/Set-PSRuleGitHubOutput.ps1) to aggregate PSRule output into Custom Markdown content and display it to the Actions run summary page.

<img src="./media/CIEnvironment/PSRuleSummary.png" alt="PSRule Summary">


Binary file added docs/wiki/media/CIEnvironment/PSRuleSummary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions ps-rule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
AlexanderSehr marked this conversation as resolved.
Show resolved Hide resolved
# PSRule for Azure configuration
#

# Please see the documentation for all configuration options:
# https://aka.ms/ps-rule/options
# https://aka.ms/ps-rule-azure/options

# Configure binding for local rules.
binding:
preferTargetInfo: true
targetType:
- type
- resourceType

# Require minimum versions of modules.
requires:
PSRule: '@pre >=2.4.0'
PSRule.Rules.Azure: '@pre >=1.19.2'

# Use PSRule for Azure.
include:
module:
- PSRule.Rules.Azure

execution:
suppressedRuleWarning: false
notProcessedWarning: false

output:
culture:
- 'en-US'

input:
pathIgnore:
# Ignore other files in the repository.
- '**/*'
# Do not ignore tests.
- '!modules/**/*.test.bicep'

configuration:
# Enable automatic expansion of Azure parameter files.
AZURE_PARAMETER_FILE_EXPANSION: false

# Enable automatic expansion of Azure Bicep source files.
AZURE_BICEP_FILE_EXPANSION: true

# Configures the number of seconds to wait for build Bicep files.
AZURE_BICEP_FILE_EXPANSION_TIMEOUT: 10

rule:
# Enable custom rules that don't exist in the baseline
includeLocal: false
exclude:
# Ignore the following rules for all resources
- Azure.KeyVault.PurgeProtect
Loading