DevOps Publish Error: EPERM operation not permitted

Viewed 6620

When building an artifact using Azure DevOps, "Publish artifact" task failed with error

Publishing build artifacts failed with an error: EPERM: operation not permitted

2 Answers

When you are using A file server option as an Artifact publish location for Publish task, make sure the Agent/Service has access to the server.

In my case, I added the agent in Administrator group to be able to do WRITE operation.

If you use self-hosted agent, by default it runs as local NETWORK SERVICE account that doesn't have access to remote shares. So you should either:

  1. Change agent's logon account. For some reason Microsoft doesn't recommend to change it from Services snap-in, but rather reconfigure it from their scripts.
  2. Grant to local NETWORK SERVICE account access to remote share. To do it, you need to add computer account with your agent (i.e. "DOMAIN\ServerA$") to Share and NTFS permissions on the shared folder. See for example here.
Related