Validating locally#
While preparing infrastructure code artifacts, Azure resources can be validated locally. PSRule for Azure can be installed locally on MacOS, Linux, and Windows for local validation.
Tip
If you haven't already, follow the instructions on Installing locally before continuing. If analyzing Azure resources from Bicep source files, complete Setup Bicep.
With Visual Studio Code#
An extension for Visual Studio Code is available for an integrated experience using PSRule for Azure.
The Visual Studio Code extension includes a built-in PSRule: Run analysis
task.
To learn about tasks in Visual Studio Code see Integrate with External Tools via Tasks.
To use PSRule for Azure with the built-in PSRule: Run analysis
task, insert the following into .vscode/tasks.json
.
{
"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"
}
}
]
}