visual-studio-codeazure-devopsazure-pipelines-yaml

Why does VS Code give linting errors for a valid Azure Pipelines YAML file?


I have a valid pipeline.yaml that succeeds when it is ran in a DevOps Pipeline. But when I edit it in VS Code, I get squiggly lines on following code:

stages:
- stage: deployResources
  displayName: 'Deploy resource group'
  jobs:
  - job: deploymentGroup
    displayName: 'run deployment group'
    steps:
    - task: AzureResourceManagerTemplateDeployment@3 <-- this whole section
      inputs:
        ...

The popup says:

String does not match the pattern of "^PowerShell@2$".yaml-schema: Azure Pipelines

Like this:

enter image description here

I have Microsoft's Azure Pipelines extension installed. Can somebody confirm if they have the same behavior - is it a bug in the extension or something wrong in my local setup?


Solution

  • Make sure you have set the language mode to the language mode provided by your azure extension. VS Code comes with a general YAML language support extension and that might well have been automatically detected as the language mode.

    You may want to try using the file association setting for the path patterns for these files to not have to fight automatic language detection all the time.