locked
Users list in tfs 2015 RRS feed

  • Question

  • Hi,

    how to export all users from TFS 2015.

    we need to this to get this list for audit purpose.

    we did tried sidekick but that is just give the role and permission for user which we do not need

    just we need list which access level type.

    Thanks

    DJM

    Thursday, April 13, 2017 11:57 AM

Answers

  • Hi DilipJM,

    Yes, you could use the audit log. You just need to check the corresponding value of the access level, if the vaule is "1", it means the user stays in this access level:

    If the three values are all "0", then it means the user are not in the any of the access level.

    Note: There are many users in the log, you need to filter the users by yourself.

    Best Regards

    Limitxiao Gao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, April 18, 2017 7:26 AM
    Moderator
  • Hi DilipJM,

    I am sorry there is no other information in the list, you need to filter list manually, thank you for your understanding.

    Best Regards

    Limitxiao Gao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by DilipJM Saturday, May 6, 2017 5:01 PM
    Friday, May 5, 2017 7:11 AM
    Moderator

All replies

  • Hi DilipJM,

    Thank you for posting here.

    You could use the following API to get all the users in Project Collection Valid Users, it will give you all the users in the collection:

    using Microsoft.TeamFoundation.Client;
    using Microsoft.TeamFoundation.Server;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace GetUser
    {
        class Program
        {
            static void Main(string[] args)
            {
                TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("http://XXX:8080/tfs/DefaultCollection2015U3"));
                tfs.EnsureAuthenticated();
    
                IGroupSecurityService gss = tfs.GetService<IGroupSecurityService>();
    
                Identity SIDS = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);
    
                Identity[] UserId = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);
    
                foreach (Identity user in UserId)
                {
                    if (user != null)
                {
                    Console.WriteLine(user.AccountName);
                    Console.WriteLine(user.DisplayName);
                }
                }
                Console.ReadKey();
            }
        }
    }
    

    Or you could refer to the following blog, the sample in this blog will give you more detailed information about the users:

    https://blogs.msdn.microsoft.com/bharry/2010/10/01/dumping-the-contents-of-all-of-your-tfs-groups/

    https://blogs.msdn.microsoft.com/alming/2013/03/07/using-powershell-and-tfs-api-to-list-users-in-tfs-2010-and-2012/

    Best Regards

    Limitxiao Gao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 14, 2017 3:08 AM
    Moderator
  • Hi Limitxiao,

    Thanks for the information provided.But we are interested in the list of user with there access level type like Basic,stakeholder,advance.The method which you suggest is more specify to project related which we are not targeting now.Could you please let us know any table in the tfsconfig db or any collection level db where we can get this list.

    Thanks

    DJM 

    Monday, April 17, 2017 6:38 AM
  • Hi DilipJM,

    I am sorry, i could not find any database or api to get the access level information. About this issue, you could submit your uservoice to the following link, TFS Product Team is listening to your voice there:

    https://visualstudio.uservoice.com/forums/330519-team-services

    Best Regards

    Limitxiao Gao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 17, 2017 8:45 AM
    Moderator
  • Hi Limitxiao,

    i was going through some of KB of MS on this and i found we just need to do export audit log from the security page which we did but the problem is how to interpret which one is stakeholder and which one has basic and which one has advance level.

    https://www.visualstudio.com/en-us/docs/work/connect/change-access-levels#list-users-and-groups-who-have-access

    Please check if you can help me on this.

    as an example one of the entry in export audit log is

    so how to interpret this

    Unique Name Server Name Last Accessed (UTC) IsGroup Stakeholder Basic Advanced IsDefault
    vstfs:///Framework/IdentityDomain/abc2e5c1-7f02-4460-814e-8044124397fc\Team Foundation Feature Availability Administrators Group ID01-DEV06TFS 1 0 0 0 1

    Thanks

    DJM

    Monday, April 17, 2017 11:15 AM
  • Hi DilipJM,

    Yes, you could use the audit log. You just need to check the corresponding value of the access level, if the vaule is "1", it means the user stays in this access level:

    If the three values are all "0", then it means the user are not in the any of the access level.

    Note: There are many users in the log, you need to filter the users by yourself.

    Best Regards

    Limitxiao Gao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, April 18, 2017 7:26 AM
    Moderator
  • Hi,

    thanks for this to begin with audit this is good beginning

    one think we observe for example the if user A left the company and he was in tfs access list and now the user is not in domain but he is still in the tfs access list is this fine i guess it should be ok even though he is not in domain but in tfs user list

    Regards

    DJM

    Sunday, April 30, 2017 3:26 PM
  • Hi DilipJM,

    Yes, I think the users will be still in the list. But there is a Unique Name column to show the Domain/Account of all the users, you could filter based on the column manually.

    Best Regards

    Limitxiao Gao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 2, 2017 7:14 AM
    Moderator
  • Hi Limitxiao Gao,

    i got the unique name column but only i cant figure out if user is in tfs list and if not in domain.

    for example username ABC is in the list of tfsusers or in the unique name and if he left organization so his id should not be in domain but it is there in tfs list is there any way to figure this out.

    if not we  are ok with the current audit.

    and finally thanks for all responses.

    Regards

    DJM

    Thursday, May 4, 2017 10:27 AM
  • Hi DilipJM,

    I am sorry there is no other information in the list, you need to filter list manually, thank you for your understanding.

    Best Regards

    Limitxiao Gao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by DilipJM Saturday, May 6, 2017 5:01 PM
    Friday, May 5, 2017 7:11 AM
    Moderator