title: TF.exe and TfSecurity.exe authentication on AzureDevOps
body: <p>I have a piece of legacy c# code (console application) that runs as a nightly batch and fires off TF.exe and TFSSecurity.exe commands at AzureDevOps.
  The commands are built by the c# code and then executed by means of launching PowerShell and executing them.
  All have worked fine until now, but lately, it started failing for <code>tf30063</code> authentication errors.</p>
  
  <p><code>TF30063: You are not authorized to access https://dev.azure.com/</code></p>
  
  <p>As part of my troubleshooting I have picked a few of these commands that are being built and executed them in an interactive PowerShell session.</p>
  
  <pre><code>tf permission /recursive $/&lt;tfs_project_name&gt;/ /collection:https://dev.azure.com/&lt;organization_name&gt;/
  TFSSecurity /imx adm: /collection:https://dev.azure.com/&lt;organization_name&gt;/
  </code></pre>
  
  <p>It produces the same result - <code>TF30063: You are not authorized to access https://dev.azure.com/.</code></p>
  
  <p>The logged-on user (where the commands are run) is able to access this AzureDevOps URL via a browser.</p>
  
  <p>Digging a bit deeper I ran the command: <code>tf settings connections help</code> which returned the following output:  </p>
  
  <pre><code>Server Url : https://&lt;organization_name&gt;.visualstudio.com/  
  User       : 
  </code></pre>
  
  <p>I was actually expecting the passed URL here: <a href="https://dev.azure.com/" rel="nofollow noreferrer">https://dev.azure.com/</a><br>
  Not sure how this URL got there, or how to get it out - but, be that as it may, the empty user field arouses some suspicion.</p>
  
  <p>I am really trying to figure out what the authentication flow/procedure is when executing these commands (TF and TFSSecurity) in Powershell.
  I have been prompted for authentication by an AzureDevOps dialog once, but where do these provided credentials stored? And for how long? 
  I have been snooping around the Windows credentials in the Credential Manager, here I  found some bits and pieces - but nothing conclusive.</p>
  
  <p><strong>Question:</strong><br>
  Does anybody perhaps know how these 2 applications (tf.exe and TfSecurity.exe) handles authentication and storing of credentials? </p>
  
  <p>System specs:<br>
  OS: Windows Server 2016<br>
  Powershell Version: 5.1.14393.3053<br>
  Location (version) of the tf.exe and TfSecurity.exe
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\
  Team Explorer></p>