Search code examples
azure-devopsazure-pipelinestfvc

Getting TF30063: You are not authorized to access https://dev.azure.com/XXXX error for TF Command


I have tried the below command as inline script in powershell task with "Azure Pipelines" as Agent Pool and "vs2017-win2016" as Agent Specification.

TF merge $/ProjectX/SourceBranch $/ProjectX/TargetBranch /recursive /noprompt /login:XXXXX@domain.com,XXPWDXX

But getting the error as "TF30063: You are not authorized to access https://dev.azure.com/XXXXXXX"

I have also tried the login option as /login:domain\username,password and /login:PAT. But getting the same error.

Please anyone let me know how to fix this issue.

Note: I have administrator permission to my project.

Thanks.


Solution

  • You need to use OAuth token instead. Try to check the option Allow scripts to access the OAuth token in the agent job, and then use System.AccessToken variable in your script, something like /loginType:OAuth /login:.,$(System.AccessToken)

    enter image description here