Why am I getting error "No file found with this pattern" during Azure Devops pipeline execution?

Cataster 681 Reputation points
2025-06-26T00:38:18.3733333+00:00

I created an Azure Devops Azure Synapse Deployment Pipeline and have the following yaml file

name: Synapse-Release-$(rev:r)

trigger:
  branches:
    include:
      - workspace_publish
      
pool:
  vmImage: windows-latest

variables:
  - group: synapse-qa-vars

stages:
- stage: Deploy
  displayName: 'Deploy from Dev to QA'
  jobs:
  - deployment: DeployWorkspace
    environment: 'QA'
    strategy:
      runOnce:
        deploy:
          steps:
          - checkout: self
          - task: Synapse workspace deployment@2
            inputs:
              operation: 'deploy'
              TemplateFile: 'abc-data/TemplateForWorkspace.json'
              ParametersFile: 'abc-data/TemplateParametersForWorkspace.json'
              azureSubscription: 'Azure Dev Service Connection'
              ResourceGroupName: '$(qa-rg-name)'
              TargetWorkspaceName: '$(qa-workspace-name)'
              DeleteArtifactsNotInTemplate: false
              DeployManagedPrivateEndpoints: false
              OverrideArmParameters: |
                -workspaceName $(qa-workspace-name) -azure_datalake_storage_default_properties_typeProperties_url $(datalakeurl) -azure_synapse_dedicated_pool_default_properties_typeProperties_server $(synapseserver) -azure_synapse_dedicated_pool_default_properties_typeProperties_database $(synapsedb) -datakeyvault_properties_typeProperties_baseUrl $(KVurl)
              FailOnMissingOverrides: false
              Environment: 'prod'
              npmpackage: 'prod'

For reference this is my Azure Repos structure:

main branch:

User's image

workspace_publish branch:

User's image

I am getting this error at the Synapseworkspacedeployment step when running the pipeline:

An error occurred during execution: Error: No file found with this pattern
##[error]Encountered with exception:Error: No file found with this pattern

I tried adding $(System.DefaultWorkingDirectory)/ to the template and parameters file paths but that didnt help.

What could be the issue?? the error is very ambiguous...

Azure DevOps
{count} votes

Accepted answer
  1. Durga Reshma Malthi 6,205 Reputation points Microsoft External Staff Moderator
    2025-06-26T14:43:18.1666667+00:00

    Hi Cataster

    Thanks for your info. Please try the below steps:

    1. Move azure-pipelines.yml from main to workspace_publish
    2. Update the default pipeline definition to point to workspace_publish
    3. Trigger the pipeline manually or by pushing to that branch

    If you want to manage all pipeline logic in main, use a checkout step to check out workspace_publish branch as an additional repo or folder

    - checkout: self
      persistCredentials: true
    - checkout: git://$(Build.Repository.Name)@workspace_publish
      path: workspace_publish_code
    

    Update your template paths to:

    TemplateFile: '$(Build.SourcesDirectory)/workspace_publish_code/abc-data/TemplateForWorkspace.json'
    

    Hope this helps!

    Please Let me know if you have any queries.

    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. Durga Reshma Malthi 6,205 Reputation points Microsoft External Staff Moderator
    2025-06-26T09:56:05.57+00:00

    Hi Cataster

    Try updating your YAML like this:

    TemplateFile: '$(Build.SourcesDirectory)/abc-data/TemplateForWorkspace.json'
    ParametersFile: '$(Build.SourcesDirectory)/abc-data/TemplateParametersForWorkspace.json'
    

    If you're checking out multiple repositories or using templates from a different repo, ensure that you include:

    - checkout: self
      path: s
    

    and then refer to paths as:

    $(System.DefaultWorkingDirectory)/s/abc-data/TemplateForWorkspace.json
    

    Hope this helps!

    Please Let me know if you have any queries.

    0 comments No comments

  2. Cataster 681 Reputation points
    2025-06-26T14:06:24.1966667+00:00

    @Durga Reshma Malthi Thanks for your suggestions, however, they didnt resolve the error unfortunately. I dont even know if the problem is with the template paths json files, the error is ambiguous it doesnt really say much...

    Also Im not using different repositories. Please refer to the screenshots to see how my repo is setup with the two branches. And I already had used checkout: self in the yaml filei provided

    for reference this is the full log

    Starting: Synapseworkspacedeployment
    ==============================================================================
    Task         : Synapse workspace deployment
    Description  : Deployment task for synapse workspace v2
    Version      : 2.5.0
    Author       : Microsoft Corporation
    Help         : Displays the name of your extension v2
    ==============================================================================
    Bundle source :  https://web.azuresynapse.net/assets/cmd-api/main.js
    Starting deploy operation
    deploy operation failed
    An error occurred during execution: Error: No file found with this pattern
    ##[error]Encountered with exception:Error: No file found with this pattern
    Finishing: Synapseworkspacedeployment
    
    0 comments No comments

  3. Durga Reshma Malthi 6,205 Reputation points Microsoft External Staff Moderator
    2025-06-26T14:21:25.17+00:00

    Hi Cataster

    Could you please try explicitly echoing the working directory in a step right before the deployment:

    - script: echo $(System.DefaultWorkingDirectory)
    

    Then add this format to the file paths:

    TemplateFile: '$(System.DefaultWorkingDirectory)/abc-data/TemplateForWorkspace.json'
    ParametersFile: '$(System.DefaultWorkingDirectory)/abc-data/TemplateParametersForWorkspace.json'
    

    If not worked, then try wrapping it explicitly in glob syntax:

    TemplateFile: '$(System.DefaultWorkingDirectory)/abc-data/**/TemplateForWorkspace.json'
    ParametersFile: '$(System.DefaultWorkingDirectory)/abc-data/**/TemplateParametersForWorkspace.json'
    

    You’re on version 2.5.0 - a recent build, but it’s worth trying explicitly pinning the latest stable version or even downgrading if 2.5.0 introduced a regression:

    Even though the workspace_publish branch triggers the pipeline, make sure your default YAML path and the pipeline definition point to that branch as well, Go to Pipelines -> Your Pipeline -> Edit -> Triggers -> YAML Tab.

    User's image

    Hope this helps!

    Please Let me know if you have any queries.

    0 comments No comments

  4. Cataster 681 Reputation points
    2025-06-26T14:34:12.35+00:00

    @Durga Reshma Malthi Thanks i already tried $(System.DefaultWorkingDirectory)/ in my first question but didnt work

    TemplateFile: '$(System.DefaultWorkingDirectory)/abc-data/TemplateForWorkspace.json'ParametersFile: '$(System.DefaultWorkingDirectory)/abc-data/TemplateParametersForWorkspace.json'
    

    Anyways I tried your second suggestion Even though the workspace_publish branch triggers the pipeline, make sure your default YAML path and the pipeline definition point to that branch as well, Go to Pipelines -> Your Pipeline -> Edit -> Triggers -> YAML Tab.

    The Default branch for manual and scheduled builds was set to main. so I changed it to workspace_publish and tried queuing afterwards but then i got this error:

    Encountered error(s): Could not find valid pipeline YAML file for this branch/tag
    

    This makes sense i suppose considering that the azure-pipelines.yml is in main not workspace_publish. On the other hand, my Template/Parameter files are in workspace_publish...please refer to my screenshots from the question to see how the repository and branches are setup currently.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.