I was trying to develop data factory pipeline using VSO deployments, I have configured my data factory to a 'Azure DevOps Git' repository with following details

Collaboration branch : master
Publish branch : adf_publish
Root folder : /ADF

I have used the following YAML script

# Sample YAML file to validate and export an ARM template into a build artifact  
# Requires a package.json file located in the target repository  
trigger:  
- master #collaboration branch  
pool:  
  vmImage: 'ubuntu-latest'  
steps:  
# Installs Node and the npm packages saved in your package.json file in the build  
- task: NodeTool@0  
  inputs:  
    versionSpec: '10.x'  
  displayName: 'Install Node.js'  
- task: Npm@1  
  inputs:  
    command: 'install'  
    verbose: true  
  displayName: 'Install npm package'  
# Validates all of the Data Factory resources in the repository. You'll get the same validation errors as when "Validate All" is selected.  
# Enter the appropriate subscription and name for the source factory.  
- task: Npm@1  
  inputs:  
    command: 'custom'  
    workingDir: '$(Build.SourcesDirectory)/ADF'  
    customCommand: 'run build validate $(Build.Repository.LocalPath)/ADF /subscriptions/[My Subscription ID]/resourceGroups/[My ResourceGroup name]/providers/Microsoft.DataFactory/factories/[My Datafactory name]'  
  displayName: 'Validate'  
# Validate and then generate the ARM template into the destination folder, which is the same as selecting "Publish" from the UX.  
# The ARM template generated isn't published to the live version of the factory. Deployment should be done by using a CI/CD pipeline.   
- task: Npm@1  
  inputs:  
    command: 'custom'  
    workingDir: '$(Build.SourcesDirectory)/ADF'  
    customCommand: 'run build export $(Build.Repository.LocalPath)/ADF /subscriptions/[My Subscription ID]/resourceGroups/[My ResourceGroup name]/providers/Microsoft.DataFactory/factories/[My Datafactory name] "ArmTemplate"'  
  displayName: 'Validate and Generate ARM template'  
# Publish the artifact to be used as a source for a release pipeline.  
- task: PublishPipelineArtifact@1  
  inputs:  
    targetPath: '$(Build.Repository.LocalPath)/ADF/ArmTemplate'  
    artifact: 'ArmTemplates'  
    publishLocation: 'pipeline'  

Below is the error I am getting

Package.json file was placed under '/ADF' folder. And below is the folder structure of my repo

I am using same YAML for automated deployment, I was also getting similar error.

I am suggesting some changes in your YAML file. Please, implement them. I hope it will work for you also.

  • You have kept package.json file inside ADF folder. I have kept it inside a folder called package in root directory not in ADF folder.
  • At line number 31 and 41 I have used value for workingDir as this value '$(Build.Repository.LocalPath)/package' not '$(Build.SourcesDirectory)/ADF'
  • At line number 49 for targetPath I have used '$(Build.Repository.LocalPath)/package/ArmTemplate' as value. This path should not make much difference.
  • I expect if you will make suggested changes in point 1 and 2 your deployment would succeed

    Thanks