Validating locally#
PSRule can be installed locally on MacOS, Linux, and Windows for local validation. This allows you to test Infrastructure as Code (IaC) artifacts before pushing changes to a repository.
Tip
If you haven't already, follow the instructions on installing locally before continuing.
With Visual Studio Code#
An extension for Visual Studio Code is available for an integrated experience using PSRule. The Visual Studio Code extension includes a built-in task PSRule: Run analysis task.
Info
To learn about tasks in Visual Studio Code see Integrate with External Tools via Tasks.
Customizing the task#
The PSRule: Run analysis task will be available automatically after you install the PSRule extension.
You can customize the defaults of the task by editing or inserting the task into .vscode/tasks.json
within your workspace.
{
"type": "PSRule",
"problemMatcher": [
"$PSRule"
],
"label": "PSRule: Run analysis",
"modules": [
"PSRule.Rules.Azure"
],
"presentation": {
"clear": true,
"panel": "dedicated"
}
}
Example
A complete .vscode/tasks.json
might look like the following:
{
"version": "2.0.0",
"tasks": [
{
"type": "PSRule",
"problemMatcher": [
"$PSRule"
],
"label": "PSRule: Run analysis",
"modules": [
"PSRule.Rules.Azure"
],
"presentation": {
"clear": true,
"panel": "dedicated"
}
}
]
}