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


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)


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.

By : MrHinsh

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