I am useing TFS 2017 on-prem.

I received a request to add label to specific path if the build success.

I added "Command Line" Task and run the command:

TF.exe vc label "New-Label" $/My-System/Version/Project 

I got an error:

[error]TF30063: You are not authorized to access

When this command running from console it work even from the build machine, but failed when it executed during build process.

Also try to run tf with loginType & login parameters, batch file or from PowerShell Task without success

** The option "Label Source" in "Get Sources" task is not relevant becuse I want to add the label to just one path from the list of paths in "Workspace mappings"


You can try to use OAuth for tfs.exe. OAuth is stored in the System.AccessToken variable. Example:

TF.exe vc label "MyLablel" MyFolder /loginType:OAuth /login:.,$(System.AccessToken) 

Additionally you have to enable the access to this variable (I can not check that because I do not have tfs 2017).

Helpful links:

  1. Allow scripts to access the OAuth token
  2. System.AccessToken
  • Thanks for the quick response. – CodeOnce Apr 18 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.