When you log into Visual Studio 2013, it caches your profile and registry credentials:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\ConnectedUser\IdeUser\Cache
HKEY_CURRENT_USER\Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage\VisualStudio\IdeUser
When you authenticate using Visual Studio Online using the TFS API, it then copies the credentials:
HKEY_CURRENT_USER\Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage\VisualStudio\VssApp
use tfs = new TfsTeamProjectCollection(Uri "https://ctaggart.visualstudio.com/DefaultCollection")
tfs.Authenticate()
How to use these values in C # or F # using Visual Studio or TFS APIs?
I realized that Vss could mean Visual Studio Services. There is Microsoft.VisualStudio.Services.Common. CredentialsCacheManager and the other in Microsoft.TeamFoundation.Client, but I'm not sure how to use it. It has ContainCredentials, GetCredentials and DeleteCredentials, so it looks promising. GetCredentials returns TfsCredentialCacheEntry , which has the Credentials property, to get System.Net.NetworkCredential, which is exactly what I'm looking for,
I don't know how to use CredentialsCacheManager, but here is what I tried.
let ccm = Microsoft.TeamFoundation.Client.CredentialsCacheManager(@"Software\Microsoft\VSCommon\12.0\ClientServices\TokenStorage\VisualStudio", false)
ccm.ContainsCredentials("IdeUser", Uri "ideuser:https://app.vssps.visualstudio.com:vssuser:federated")
Using Process Monitor, it shows that the CredentialsCacheManager is either not what I'm looking for, or I don't know how to use it:
