en-US/about_PSRule_Baseline.help.txt
TOPIC
about_psrule_baseline SHORT DESCRIPTION Describes usage of baselines within PSRule. LONG DESCRIPTION PSRule lets you define a baseline. A baseline includes a set of rule and configuration options that are used for evaluating objects. The following baseline options can be configured: - Binding.IgnoreCase - Binding.TargetName - Binding.TargetType - Configuration - Rule.Include - Rule.Exclude - Rule.Tag Baseline options can be: - Included as a baseline spec within a YAML file. - When using this method, multiple baseline specs can be defined within the same YAML file. - Each baseline spec is separated using `---`. - Set within a workspace options file like `ps-rule.yaml`. - Only a single baseline can be specified. - See about_PSRule_Options for details on using this method. BASELINE SPECS A baseline spec is defined and saved within a YAML file with a `.rule.yaml` extension, for example `Baseline.rule.yaml`. To define a baseline spec use the following structure: ```yaml SYNOPSIS: <SYNOPSIS> kind: Baseline metadata: name: <name> spec: # One or more baseline options binding: { } rule: { } configuration: { } For example: yaml SYNOPSIS: THIS IS AN EXAMPLE BASELINE kind: Baseline metadata: name: Baseline1 spec: binding: targetName: - Name - ResourceName - ResourceGroupName targetType: - ResourceType rule: include: - Rule1 - Rule2 configuration: allowedLocations: - 'Australia East' - 'Australia South East' --- SYNOPSIS: THIS IS AN EXAMPLE BASELINE kind: Baseline metadata: name: Baseline2 spec: binding: targetName: - Name - ResourceName - ResourceGroupName targetType: - ResourceType rule: include: - Rule1 - Rule3 configuration: allowedLocations: - 'Australia East' ### Baseline scopes When baseline options are set, PSRule uses the following order to determine precedence. 1. Parameter - `-Name` and `-Tag`. 2. Explicit - A named baseline specified with `-Baseline`. 3. Workspace - Included in `ps-rule.yaml` or specified on the command line with `-Option`. 4. Module - A baseline object included in a `.rule.yaml` file. After precedence is determined, baselines are merged and null values are ignored, such that: ## EXAMPLES ### Example ps-rule.yaml yaml # PSRULE EXAMPLE CONFIGURATION # CONFIGURES BINDING binding: ignoreCase: false targetName: - ResourceName - AlternateName targetType: - ResourceType - kind ADDS RULE CONFIGURATION configuration: appServiceMinInstanceCount: 2 CONFIGURE RULE FILTERING rule: include: - rule1 - rule2 exclude: - rule3 - rule4 ``` |