Teamcity setup with Visual Studio Team Services - tfs

I have been trying to integrate Team city with Visual Studio Team Services and keep getting this error, can anyone help.
I have enabled basic authentication in tfs by going to
TFS -> Profile -> basic authentication.
Trying to create a Create Project From URL on TeamCity, Getting error on below setting.
Settings
Repository URL: * https://xxxxxx.visualstudio.com/DefaultCollection/AddBk
Error
Could not create a project by specified URL, URL is not recognized

You need to specify the repository as including the collection but not the project.
So http://mytfs.visualstudio.com/defaultcollection as the repository and then you can specify the $/myTeamProject/[path] in the "root" variable.
http://confluence.jetbrains.com/display/TCD8/Team+Foundation+Server
For credentials I would recommend that you use the server account credentials rather than local user ones. You can get the server credentials through the API or by using the TFS Credential Viewer.

Related

TFSFieldMapping Access is Denied

Hi I'm am trying to follow Microsoft's guidance to download the TFSFieldMapping file in order that I can make changes (https://learn.microsoft.com/en-us/azure/devops/reference/xml/upload-or-download-the-microsoft-project-mapping-file?view=tfs-2018)
Unfortunately I keep getting the error "Access is denied" when I try to connect to my collection and project
CD C:\Program Files\Common Files\microsoft shared\Team Foundation Server\16.0>TFSFieldMapping.exe download /collection:https://dev.azure.com/(My Company) /teamproject:(My Project)/mappingfile:"C:\Users\danie\Downloads\Test1234.xml"
"Access is denied"
That documentation appears to be for TFS (on-premise). Based on the URL, it looks like you are utilizing Azure DevOps Services. It seems to be a deprecated function, probably because of the way the field templates have been overhauled for work item forms.
Agree with Matt. TFSFieldMapping is only supports TFS 2018 and previous versions. Because their process is Hosted XML Process. Starting from Azure Devops Server 2019 and azure devops service, they use the inherited process. So they doesn't support the TFSFieldMapping.
From the URL in the TFSFieldMapping command, it seems that you are using the Azure Devops Service.
To change the Project field, you can create an inherited process and let the project use it. Then you can perform custom operations (e.g. Custom field) on the inherited process.
You could custom the field in Organization Settings -> Process.
Here is a doc about the detailed steps.
You could also use Rest API to Get and Update the field.
Get Work item field:
GET https://dev.azure.com/{organization}/{project}/_apis/wit/fields?api-version=5.1
Update Work item field:
PATCH https://dev.azure.com/{organization}/{project}/_apis/wit/fields/{fieldNameOrRefName}?api-version=4.1
Note: Corresponding to the inheritance process, you need to inherit first and then customize

Cannot connect to Team project collection

I'm new to Jenkins and am trying to set up the team project collection. My servername is:
http://<server-name>/tfs/Development%20and%20CFS%20UK/
I've left the last bit in so you can see it has spaces.
I'm adding the Jenkins credentials as:
Domain: Global credentials (it won't let me choose anything else)
Kind: Username with Password
Username: my windows domain\username used to access TFS
Password: my windows password used to access TFS
ID/Description, not sure whether these are important - assume not!
The error I receive is as follows:
javax.servlet.ServletException: com.microsoft.tfs.core.exceptions.TECoreException: The SOAP endpoint http://<server-name>/tfs/Development%20and%20CFS%20UK/Services/v1.0/Registration.asmx could not be contacted. HTTP status: 502
If I cut and paste the url above into a browser it appears fine, with the following message:
Team Foundation Registration web service
The following operations are supported. For a formal definition, please review the Service Description.
GetRegistrationEntries
The login name is important which must contain the name of domain and user.
For [on-premises] Team Foundation Server, the User name can be
specified in two ways:
EXAMPLE-DOMAIN\user
user#domain.example.com
Suggest you to use the latest Team Foundation Server Plugin in Jenkins, more details of the job configuration, you can check the release note.
To narrow down if the space of your team project collection cause the issue, you could give a try with another collection url without space.
Update
If you copy the collection url in browser, it should link to a TFS web portal.

Can TFS work with a local user account?

I'm trying to use the Jenkins TFS Plugin and have trouble authenticating. I saw that user on the TFS administration, and gave it permissions on my project.
I've created a local user account (via Local Users and Groups) - TfsServer\TfsUserAdmin, and I'm trying to use it to authenticate against the TFS server.
I able able to use the name and password of the user. For example this works (though it prints an empty list):
tf workspaces -format:brief -server:http://TfsServer:8080/tfs/Redacted_Collection -login:TfsServer\TfsUserAdmin,RedactedPassword
If I change the password on the above command I get an error, so authentication does work.
The next command is:
tf workspace -new "RedactedWorkspaceName;" -noprompt -server:http://TfsServer:8080/tfs/Redacted_Collection -login:TfsServer\TfsUserAdmin,RedactedPassword
This fails with the error:
TF14045: The identity TfsServer\TfsUserAdmin is not a recognized identity.
I don't think I can change these commands, they are created by the plugin.
I've found people with similar errors, but none of them had the user name at the error - only a GUID or the server name.
Can I work with TFS and a local user?
You will likely need to use Shadow Accounts to get your Jenkins server to talk to TFS...
Create a local user on both your TFS server and your Jenkins server with the same Username & Passowrd. Then use that account to authenticate.
This is the only way to get cross domain coms working without trust and is a feature of Windows & AD. If your org has disabled it you will need to look at creating a trust relationship between your domains.

Change credentials per server?

I've installed opshub on my pc that is on domain ABC. I have succesfully migrated projects from a TFS server on domain ABC to visual studio online. Now I've added a TFS server that is in domain DEF and it doesn't ask me for credentials for that server. I just get a blank collection list, I think its trying to use my current credentials from domain ABC. How can I get it to ask me for the credentials to domain DEF when trying to access that server?
User level authentication details are stored inside Team Foundation cache directory under following locations. If you have already authenticated for the TFS server then details for that server is stored inside cache directory. This won't ask you credentials again while you are doing next migration.
If you want to authenticate with the new credentials for different domain you need to clear data from the following directories.
C:\Users{User}\AppData\Local\Microsoft\Team Foundation\4.0\Cache
C:\Users{User}\AppData\Local\Microsoft\Team Foundation\5.0\Cache
Make sure original folders remains there (Cache). Just remove contents of those directories. Also make sure you close all the applications which uses TFS cache like visual studio, opshub migration utility.
See http://blogs.msdn.com/b/visualstudioalm/archive/2012/08/29/clearing-the-credentials-for-connecting-to-a-team-foundation-server.aspx for correct answer. It worked for me.

Can I use teamfoundation server from another domain?

I have a prod domain and a test domain, unfortunately in the only part I can install TFS ins a virtual machine in the test domain.
The question is, as developers, can we still access the tfs for source control? As far as I know it will use the windows credentials when connecting and those credentials wont exist in the test environment.
What can you suggest?
Yes, Team Explorer clients will try to authenticate with the default Windows credentials to the TFS server. If you're on different domains (and there's no trust relationship between them) then this authentication will fail and you'll be prompted to enter your username/password for the TFS server.
If you don't wish to be prompted each time, you can set up credentials for the server in the Windows Credential Manager in your Control Panel.

Resources