I'm trying to work with TFS 2018 Artifacts.
I created a very simple build (definition)- it has one agent phase that uploading artifact, and then another agent that should download the artifact.
The Download Build Artifact failed with Unauthorized:
Downloading artifacts from: {...}/tfs/DefaultCollection//_apis/resources/Containers/262302?itemPath=Artifact&isShallow=true&api-version=4.1-preview.4
Failed to parse response body: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>401 - Unauthorized: Access is denied due to invalid credentials.</title>
.
.
.
(Also this message appears five times)
More details (please comment for asking to add more)
Both phases marked with this:
According to the error message:
This is an authentication issue, you could check if those two Agent phases use the same build agent. And try to enable the option
Allow scripts to access OAuth token
in theAgent phase
page:If you are using different build agent, you should make sure your account has permission to access that agent:
Agent Pools
->Agents
->Roles
Add your account as
user
oradmin
.If above not resolve this issue, I would like provide you a workaround to resolve it:
Create a share folder on your TFS server, then make sure your account could access that share folder, now we could publish our artifact to that share folder instead of
Visual Studio Team Services/TFS
: