PSRule.Rules.CAF icon indicating copy to clipboard operation
PSRule.Rules.CAF copied to clipboard

Add documentation for overriding default configuration

Open BernieWhite opened this issue 4 years ago • 2 comments

PSRule for CAF includes a number of configuration options which include the defaults.

Currently no documentation is provided on overriding these configurations with different values.

BernieWhite avatar Feb 04 '21 03:02 BernieWhite

Hi @BernieWhite I believe that locally, I can tamper with Baseline.Rule.yaml, CAF.Common.Rule.ps1, CAF.Name.Rule.ps1, CAF.Tag.Rule.ps1, Config.Rule.yaml but in pipeline only thing that I can think of is to subdivide the operations of running PSRule.Rules.CAF into installing the module, overwritting mentioned .ps1 files with my own prepared in repo and then asserting the rule. If there is a better way, please let me know. I'm not sure if the overriding feature is missing or just documentation on how to do it. Maybe something needs to be added to ps-rule.yaml?

majorku5anagi avatar Apr 09 '22 22:04 majorku5anagi

@majorku5anagi You can create a custom baseline or override settings in ps-rule.yaml.


Creating baselines is covered in https://microsoft.github.io/PSRule/v2/concepts/PSRule/en-US/about_PSRule_Baseline/. You can create a custom baseline in the .ps-rule/ directory and reference it within your pipeline.

PSRule GitHub Action and Azure DevOps assert task allows a named baseline to be specified by the baseline: parameter.


To override in ps-rule.yaml specify one or more configuration options. For example:

configuration:
  CAF_UseLowerNames: false
  CAF_StoragePrefix: [ 'orgst', 'orgstvm', 'orgdls' ]

The list of configuration defaults is available from the built-in baseline: https://github.com/microsoft/PSRule.Rules.CAF/blob/main/src/PSRule.Rules.CAF/rules/Baseline.Rule.yaml

Not all configuration defaults are currently in use.

BernieWhite avatar Apr 10 '22 07:04 BernieWhite