As part of our build process we have some YAML files, I would like to validate these files and ideally Lint them.


What would be the best way to go about this please ?

There are no lint cmdlets that are native to PowerShell.

You’d have to leverage C/C++ to get such things and use PowerShell Add-Type cmdlet to bring such DLL’s in to your script for use.
I personally don’t use YAML, so, I’ve had no reason to look at it to date or look up any API / DLL needed to interact with it.

There are request in the PowerShell GitHub to have cmdlets for YAML, but that is not linting.

ConvertFrom-Yaml, ConvertTo-Yaml

However, a quick web search for ‘powershell yaml lint’ turns up several hits you can leverage.


YAML in powershell powershell doesn't have native support for yaml. Solution: PSYAML and powershell-yaml

PSYaml: PowerShell does YAML - Simple Talk

GitHub - cloudbase/powershell-yaml: PowerShell CmdLets for

on GitHub:
…which is a wrapper for the YamlDotNet library:

uses in YAML in PSDeploy

There are Linter if you are using VSCode as your editor. It’s part of the extension library, but none are PS specific.

you can use yamllint , but it has no relation with PowerShell and cannot run on windows by default. As @postanote mentioned, VSCode yamllint plug-in is the best way to achieve this in Windows.

Thanks for the replies. I was hoping I had over looked an obvious YAML Linter that I could implement into our build process. This doesn’t look to be the case.