Azure Web Job “The specified registry key does not exist” using TFS API

Question!

I am trying to connect to TFS online through an Azure WebJob. All works well until I try and execute this line.

WorkItemStore workItemStore = tpc.GetService<WorkItemStore>();

I get the following error:

[03/06/2015 15:32:26 > cb28d4: ERR ] Unhandled Exception: System.IO.IOException: The specified registry key does not exist. [03/06/2015 15:32:26 > cb28d4: ERR ] at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) [03/06/2015 15:32:26 > cb28d4: ERR ] at Microsoft.Win32.RegistryKey.CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, Object registrySecurityObj, RegistryOptions registryOptions)



Answers

http://knowledge-base.havit.cz/2015/01/06/pristup-k-team-foundation-serveru-z-azure-website/

NetworkCredential networkCredential = new NetworkCredential(_userName, _password, null);
TfsClientCredentials tfsClientCredentials = new TfsClientCredentials(new WindowsCredential(networkCredential),
    new SimpleWebTokenCredential(null, null), allowInteractive: false);
TfsTeamProjectCollection teamProjectCollection = new TfsTeamProjectCollection(uri, tfsClientCredentials);
WorkItemStore workItemStore = new WorkItemStore(teamProjectCollection);
By : Venky


You are not going to be able to use the TFS API from an Azure web job as Team Explorer is not installed there.

You will need to use the rest API instead.

https://www.visualstudio.com/en-us/integrate/get-started/rest/basics

By : MrHinsh


This video can help you solving your question :)
By: admin