5

I'm trying to migrate from on-premises TFS to Visual Studio Online. We have quite elaborate TeamCity build process that we don't want to migrate away from, so having TeamCity working with VSO would be ideal.

I've created alternative user credentials (as per this article) and using these credentials in TeamCity. But when I create new VCS in TeamCity, I get connection error:

TF30063: You are not authorized to access https://myproject.visualstudio.com/DefaultCollection/MyProject

I've tried my actual credentials (not alternative ones) but nothing changed - same error.

Also I've tried using alternative credentials with tf command line tool and could not enter alternative credentials - a window popped up, asking me for my LiveId.

Any idea how to fix this?

p.s. this is how TeamCity configuration look like:

enter image description here

trailmax
  • 34,305
  • 22
  • 140
  • 234
  • Try: `https://myproject.visualstudio.com/DefaultCollection/` instead of adding the project name. Then in the source control paths use `$/ProjectName/Path/To/File`. – jessehouwing Jun 23 '14 at 12:33
  • Also make sure you enter the credentials correctly, see: http://stackoverflow.com/a/18695231/736079 and http://confluence.jetbrains.com/display/TCD8/Team+Foundation+Server. – jessehouwing Jun 23 '14 at 12:40
  • That is TFS project, no Git involved. And I did try both paths with https://....com/defaultcollection/$projectname/ and without /$projectnam - no difference – trailmax Jun 23 '14 at 12:50
  • It **must** be without the project name in the URI. You're connecting to the Project Collection in TFS, not to the Team Project directly. Can you post a screenshot of your alternate credentials and your VCS root settings? – jessehouwing Jun 23 '14 at 13:00
  • @jessehouwing posted screenshot, but don't think this is the issue. I had VS updates missing, so getting them installed. – trailmax Jun 23 '14 at 14:04
  • Have you tried setting the alternate credential name to match your live id? Last time I tried it didn't work when I used a different name there. – jessehouwing Jun 23 '14 at 14:12
  • @jessehouwing Yep, tried my actual username with alternative password and all other possible combinations of usernames/passwords. No luck. – trailmax Jun 23 '14 at 14:16

4 Answers4

5

To connect to Visual Studio Online you indeed need to enable alternate credentials on the account you'll use for Team City. Ensure that at least Team Explorer 2012 and update 4 is installed on the Team City server, install the whole Visual Studio 2012 incl Update 4. Team City requires at least update 2, but Microsoft only supports Visual Studio 2012 RTM and the latest update (which is update 4).

Then in the connection screen use the following information: enter image description here

Repository URL: https://myaccount.visualstudio.com/DefaultCollection

Username: ##LIVEID##\your.email@live.com // Your visual Studio Online User Name, must match your LiveId.

Password: ********* // The password you setup for the alternate credentials.

You can also use the VSO Service Account credentials instead of using Alternate Credentials.

Then in your VCS Root configuration map your TFVC root in the following way:

Root: $/MyProject/Path/To/Branch/Root

Check out this post on the Jetbrains Confluence site for more details.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • 1
    I did miss "##LIVE##\" prefix, but with it it still does not work. I have noticed that Jetbrains requires "Visual Studio 2012 Update 1", which is not installed at the moment. Probably this is the issue. I'll get it installed overnight and will report back. Thanks for help so far. – trailmax Jun 23 '14 at 14:02
  • Since Microsoft only supports the latest update version of Visual Studio, I suggest installing Visual Studio 2012 update 4. – jessehouwing Jun 23 '14 at 14:10
  • Yep, could not get update 1, so installing VS2012 Update 4 as we speak. – trailmax Jun 23 '14 at 14:12
  • 1
    After update to VS2012.4 I managed to connect to VSO successfully. Thank you for your help! – trailmax Jun 23 '14 at 14:35
  • It would be better to use the service account credentials rather than a users credentials. You can get this by using the TFS Credential Viewer: http://nakedalm.com/getting-service-account-vso-tfs-service-credential-viewer/ – MrHinsh - Martin Hinshelwood Jun 29 '14 at 17:13
  • This is great. My only issue was that my TC server had Team Explorer 2012 on it, when I installed what I thought was VS2012 with Update 4, it was actually just "Update 4" and it updated Team Explorer. In the end, it still worked and I didn't need the full VS2012 to make it happen. Thanks! – EJA Jun 22 '16 at 23:25
2

This has changed lately and the password needs to be generated.

Navigate to your site at https://[your project].visualstudio.com/_details/security/tokens And generate a personal access token. And use it for password in your teamcity vcs root configuration. Username is your email.

https://streamlined.no/2016/09/19/connecting-teamcity-10-vcs-root-visual-studio-team-services/

Note: TeamCity 10 does not need the ##LIVE## workaround anymore.

tomludd
  • 96
  • 6
  • This worked for me. I was using the "Alternate Authentication Credentials" when the server suddenly had an error connecting with this. Switched to using a generated Personal access token and got everything working again. Still no idea why the other connection suddenly started failing as we made no changes to the environment since our last successful connection/build. – My Stack Overfloweth Jul 13 '18 at 21:36
0

I had the same problem today. The TC instance which was working fine last week mysteriously could not connect to any VCS Roots after the weekend. All VCS roots are git repos in visual studio online.

The Test Connection was failing and changing to known working user accounts still failed.

Restarting the TC service also had no impact on the problem. In the end, rebooting the whole TC Server fixed the issue. Hopefully this will help someone else out.

TheLogicMan
  • 371
  • 4
  • 12
0

Well, I could not use Alternate credentials as I use it in many build configurations and it was set up to poll every 60 seconds. So I had to do much manual work to fix it up. Instead, I generated a Personal Access Token and in the Team City VCS setup for Git I entered "username" as the username and pasted the PAT into the password. That worked much better and more stable than Alternate credentials, which kept getting disabled because of background polling on behalf of Team City.

Tore Aurstad
  • 3,189
  • 1
  • 27
  • 22