Jaa


Adding CCF Agents Programmatically

One of the most annoying features for admins with managing CCF is adding Agents. Updating/Deleting are less annoying as they are not in bulk most of the times. Even manually adding Agents using CCF Admin Console is not productive when adding more than few users.

CCF Admin Console, internally uses WCF web services (in CCF 2008) to perform database related activities. You can write a custom program consuming these web services to ease your configuration. This is much faster way of handling the agents in the database.

Warning: You should not get carried away with this approach and communicate to the database directly bypassing the webservices or if there is no web service for a desired database operation. This might cause long term problem when the CCF team changes their database. In worst case, it might even void your support.

Now that we know what we should and shouldn't do, let me show some sample code to do the same.

Every installation of CCF 2008 (server) installs several web services and the one we are interested here is AgentWS. Since we know the web service now, it is a simple WCF webmethod invokation.

Following code illustrates how to add user to the database.

             AgentWSClient agentService = new AgentWSClient("BasicHttpBinding_AgentWS");             

try            {                AgentDetails agentDetail = new AgentDetails();<br>                agentDetail.FirstName = "John";<br>                agentDetail.LastName = "Smith";<br>                agentDetail.DomainId = "contoso\\jsmith";<br>                agentDetail.AgentType = 1; //1 - Agent, 2 - Admin<br>                agentService.Add(agentDetail);<br>            }             



finally            {<br>                agentService.Close();<br>            } 

As simple as this...

You can probably write a small application that will fetch the user information from the Active Directory or any other list of users and add them all into the CCF database.

Comments

  • Anonymous
    May 16, 2009
    Whilst this was very helpful, is it also possible to associate the agents to groups in AzMan store or should we rely on the AzMan API instead?

  • Anonymous
    May 16, 2009
    I'd not prefer doing this directly using AzMan API. This restricts you from moving to SQL/AD later. So, you should do that using CCF webservices. One caution with this approach though. If you are upgrading the CCF installation, you might have to revisit the tools you write with the updated services API to keep them working. :)