Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>PSRuleNew to Visual Studio Code? Get it now.
PSRule

PSRule

Preview

Microsoft

microsoft.com
|
470 installs
| (0) | Free
Validate infrastructure as code (IaC) and DevOps repositories using PSRule.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PSRule

Validate infrastructure as code (IaC) and DevOps repositories using the PSRule. PSRule is powerful, feature rich, and highly customizable to meet your needs.

Features

CodeLens

CodeLens showing link to create documentation

  • CodeLens shows links to create or edit markdown documentation from rules in YAML, JSON, or PowerShell.
    • Open documentation — Opens rule markdown documentation in the editor.
      • The location for storing documentation is configurable in the extension settings.
      • By default, a locale specific folder is created in the same directory as the rule file.
    • Create documentation — Creates a new markdown file for the rule based on a snippet.
      • New markdown documentation is created with the built-in Rule Doc snippet.
      • An alternative snippet can be specified by configuring extension settings.

IntelliSense

Options suggestion context menu

  • Adds IntelliSense and validation support for configuring options and resources.
    • Workspace options — use IntelliSense to configure options for the workspace.
      • Type or trigger IntelliSense with Ctrl+Space from ps-rule.yaml.
    • Create resources — define baselines and selectors by using pre-built snippets and IntelliSense.

Rule definition snippet

  • Adds snippets for defining new rules.
    • Define rules with snippets and IntelliSense support.
      • Trigger IntelliSense by typing rule in a .Rule.ps1, .Rule.yaml, or .Rule.jsonc file. IntelliSense can also be triggered by using the shortcut Ctrl+Space.

Rule markdown documentation snippet

  • Adds snippets for creating markdown documentation.
    • Quick documentation — create rule documentation to provide rule recommendations and examples.
      • Trigger IntelliSense by typing rule in a .md file. IntelliSense can also be triggered by using the shortcut Ctrl+Space.

Quick tasks

Built-in tasks shown in task list

  • Adds quick tasks for analysis directly from Visual Studio Code.
    • Run analysis — runs rules against files in the current workspace.
      • Input path, Baseline, Modules, and Outcome options can be configured per task.
      • Output as, and showing a Not processed warning options can be configured by workspace or user.
      • Rule stored in .ps-rule/ are automatically used by default.
      • Use the built-in analysis task by running or configuring the task from the Terminal menu.

Configuration

In addition to configuring the ps-rule.yaml options file, the following settings are available.

Name Description
PSRule.codeLens.dependencyManagement Enables Code Lens that displays links to manage dependencies.
PSRule.codeLens.ruleDocumentationLinks Enables Code Lens that displays links to rule documentation.
PSRule.documentation.path The path to look for rule documentation. When not set, the path containing rules will be used.
PSRule.documentation.localePath The locale path to use for locating rule documentation. The VS Code locale will be used by default.
PSRule.documentation.customSnippetPath The path to a file containing a rule documentation snippet. When not set, built-in PSRule snippets will be used.
PSRule.documentation.snippet The name of a snippet to use when creating new rule documentation. By default, the built-in Rule Doc snippet will be used.
PSRule.execution.ruleExcluded Determines how to handle excluded rules. When set to None, PSRule will use the default (Ignore), unless set by PSRule options.
PSRule.execution.ruleSuppressed Determines how to handle suppressed rules. When set to None, PSRule will use the default (Warn), unless set by PSRule options.
PSRule.execution.unprocessedObject Determines how to report objects that are not processed by any rule. When set to None, PSRule will use the default (Warn), unless set by PSRule options.
PSRule.experimental.enabled Enables experimental features in the PSRule extension.
PSRule.lock.restore Determines if workspace modules will automatically be restored during activation. Modules can be restored manually using the PSRule: Restore modules command.
PSRule.notifications.showChannelUpgrade Determines if a notification to switch to the stable channel is shown on activation.
PSRule.notifications.showModuleRestore Determines if a notification to restore modules is shown on activation.
PSRule.notifications.showPowerShellExtension Determines if a notification to install the PowerShell extension is shown on activation.
PSRule.options.path The path specifying a PSRule option file. When not set, the default ps-rule.yaml will be used from the current workspace.
PSRule.output.as Configures the output of analysis tasks, either summary or detailed.
PSRule.rule.baseline The name of the default baseline to use for executing rules. This setting can be overridden on individual PSRule tasks.
PSRule.trace.task Determines the level of trace information to output for PSRule tasks.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft