Georgi Koemdzhiev
Georgi Koemdzhiev

Reputation: 11931

Unable to publish to File Share in Azure build pipeline

I am switching our pipelines from using on-prem build agent pool to a Hybrid Activation build agent (on-prem server with SSM Agent installed).

I am hitting a small issue when building our artefact. Our build pipeline does not seem to be able to publish the build artefact to the below File Share path on the new agent pool:

\\vwcnexstore08.comp.internal.corp\tfs_scm_drop\BuildDrops\$(System.TeamProject)\$(Build.DefinitionName)\$(Build.BuildNumber)

I am getting this error when I run the build:

Publishing build artifacts failed with an error: Unable to create directory '\\vwcnexstore08.comp.internal.corp\tfs_scm_drop\BuildDrops\CarEvaluator\CarEvaluator (dev branch)\CarEvaluator (dev 
branch)_2.0.0293\drop'.
Unable to verify the directory exists: '\\vwcnexstore08.comp.internal.corp\tfs_scm_drop\BuildDrops\CarEvaluator\CarEvaluator (dev branch)\CarEvaluator (dev branch)_2.0.0293\drop'.
If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share.

This is my PublishBuildArtifacts task

steps:
- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
    ArtifactName: '$(Parameters.ArtifactName)'
    publishLocation: FilePath
    TargetPath: '\\vwcnexstore08.comp.internal.corp\tfs_scm_drop\BuildDrops\$(System.TeamProject)\$(Build.DefinitionName)\$(Build.BuildNumber)'

Note: The above used to work fine with the previous Agent pool

Could someone please share what I am doing wrong?

Upvotes: 0

Views: 1050

Answers (1)

Leo Liu
Leo Liu

Reputation: 76670

Unable to publish to File Share in Azure build pipeline

According to the document Publish Build Artifacts task:

enter image description here

The path must be a fully-qualified path or a valid path relative to the root directory of your repository.

So, you should make sure the TargetPath could be access on your on-prem server.

On the other hand, if the TargetPath is not share for everyone, the project build service account (“BuildService (orgname)”) is in the whitelist for access.

Upvotes: 1

Related Questions