已答覆 Which settings for IdentityUpdatePeriod?

  • Wednesday, September 01, 2010 8:02 AM
     
     

    Fellow TFS administrators,

    As I wasn't able to configure TFS sync cycle to my liking I wanted to ask which value should be used for the IdentitySyncCycleDuration setting?

    I tried 600, because I assumed it to be seconds and now the sync cycle is obviously set to 30 hours, since there is the following entry on the application event log:

    "Incremental sync (current cycle start time (UTC) 8/25/2010 10:00:30 AM, cycle duration 30.00:00:00, number of syncs per cycle 720)."

    Well it turns out it isn't. At the next regular interval (every hour) it synced again stating:

    "Incremental sync (current cycle start time (UTC) 8/25/2010 10:00:30 AM, cycle duration 1.00:00:00, number of syncs per cycle 24)."

    In the end I would like to sync (=IdentitySyncCycleDuration) every 15 minutes. What would be the corresponding setting for n in the follwing script?

    [Reflection.Assembly]::Load("Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

    # Modify the TFS configuration server URL as necessary.
    $configServer = new-object Microsoft.TeamFoundation.Client.TfsConfigurationServer "http://localhost:8080/tfs/"

     # Get the TF registry service.
    $tfsRegService = $configServer.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamFoundationRegistry])

    $tfsRegService.SetValue("/Service/Integration/Settings/IdentitySyncCycleDuration", n)

    # Which value syncs every 15 minutes???

    Thanks in advance!


    Namaste! Fred

All Replies

  • Wednesday, September 01, 2010 9:52 PM
     
     

    If I get you right, you want the sync to start every 15 minutes ?

    The start of the sync is controled by the TFS Job Agent, and can be changed, either by using the Job Services API or by editing the right table in TFS_Configuration databas.

    I think you will find this post about Identity Syncronization helpfull http://blogs.msdn.com/b/vasu_sankaran/archive/2010/06/07/identity-synchronization-in-team-foundation-server-2010.aspx

     

  • Thursday, September 02, 2010 5:56 AM
     
     

    Hello Mattias,

    Thank you for your reply. Hongye already sent me that link answering a similar post.

    But I'm no developer, I'm only administrating our TFS farm and therefore I would like to know the following:

    1 ) Concerning my original post: which value of n sets the synchronization to "every 15 minutes"

    2) Concerning the link: how would I trigger the RefreshIdentity method in a Powershell script for a certain TFS group?

    Thank you all for your support!

     


    Namaste! Fred
  • Thursday, September 02, 2010 6:14 AM
    Moderator
     
     

    Hi,

    30.00:00:00 just means 30 days.

    If you want to Sync Identity every 15 mins, what you need to do is edit the job schedule. Sorry that I am not familiar with PS script, following code is in C#

    Microsoft.TeamFoundation.Client.TfsConfigurationServer server = new Microsoft.TeamFoundation.Client.TfsConfigurationServer(new Uri("http://server:8080/tfs"));
                var jobService = server.GetService<ITeamFoundationJobService>();

    //The guid 544DD581-F72A-45A9-8DE0-8CD3A5F29DFE is identical in every TFS instance for Team Foundation Server Periodic Identity Synchronization

    //Job .
                var jobs=jobService.QueryJobs(new Guid[]{new Guid("544DD581-F72A-45A9-8DE0-8CD3A5F29DFE")});

                if (jobs.Length == 1)
                {
                    var Identity_SynchronizationJob = jobs[0];
                    Identity_SynchronizationJob.Schedule.Clear();

                    TeamFoundationJobSchedule schedule = new TeamFoundationJobSchedule(DateTime.Now, 900, TimeZoneInfo.Utc);
                    Identity_SynchronizationJob.Schedule.Add(schedule);

                    jobService.UpdateJob(Identity_SynchronizationJob);

                }


    Best regards,
    Ruiz
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com
  • Thursday, September 02, 2010 6:20 AM
     
     

    Hello Ruiz,

    Thanks for your quick reply!

    Can somebody please "translate" that to Powershell? Sorry, but my skill level in programming is comparable to that of a 5 year old ;-)

    Thanks again!


    Namaste! Fred
  • Thursday, September 02, 2010 8:35 PM
     
     

    You could simply change the value in the TFS Configuration database by changing the interval value of table tbl_JobSchedule for the row with the id 544DD581-F72A-45A9-8DE0-8CD3A5F29DFE

  • Friday, September 03, 2010 6:04 AM
     
     

    Hello Mattias,

    Thanks for your suggestion!

    I read about configuring it in a database table in the blog post. But since it means meddling with the database I only consider it the last resort. 

    Preferably I'd like to accomplish it by means of a script, since I have no direct access to the database (our SQL Admins would have to do that - and they are not to eager to mess with an application database).

     


    Namaste! Fred
  • Monday, September 06, 2010 5:51 AM
    Moderator
     
     Answered

    Hi,

    Sorry for the late reply.

    You can try following script in PS

    [Reflection.Assembly]::Load("Microsoft.TeamFoundation.Client, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

    $configServer = new-object Microsoft.TeamFoundation.Client.TfsConfigurationServer(new-object System.Uri("http://<server>:8080/tfs"))
    $tfsJobService = $configServer.GetService([Microsoft.TeamFoundation.Framework.Client.ITeamFoundationJobService])
    $jobs= $tfsJobService.QueryJobs()
    $jobID = new-object System.Guid("544DD581-F72A-45A9-8DE0-8CD3A5F29DFE")


    foreach ($job in $jobs)
        {
            if (($job.JobId -eq $jobID))
            {
                $Identity_SynchronizationJob = $job
                $Identity_SynchronizationJob.Schedule.Clear()
                $schedule = new-object Microsoft.TeamFoundation.Framework.Client.TeamFoundationJobSchedule([datetime]::now, 900)
                $Identity_SynchronizationJob.Schedule.Add($schedule)
                $tfsJobService.UpdateJob($Identity_SynchronizationJob)
            }
        }


    Best regards,
    Ruiz
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com
    • Marked As Answer by Fredo Monday, September 06, 2010 8:56 AM
    •  
  • Monday, September 06, 2010 8:57 AM
     
     

    Hello Ruiz,

    Thank you! This works perfectly.


    Namaste! Fred
  • Thursday, December 30, 2010 9:34 AM
     
     

    Ruiz,

     

    My Friend, My Messiah, My God

     

    You don't know what you have created in those two scripts. 

    You have not only saved my time, but saved beating from my wife (for late work hrs), humiliation from the development team (I am good for nothing).

     

    I have no words to thank you. You have made my new year celebrations. I pray to almighty to grant all your wishes next year (so that we can get more such scripts)


    Thank you! Thank you!

     

    Amen.