0

I would like to pass information from Active Directory to a Microsoft SQL Server database any time a change is made in Active Directory. In this way the SQL will always have a reliable copy of the AD. Well, i have been reading some post that deal with similar questions, but I can't find the solution.

In this post, for example: https://stackoverflow.com/questions/4782292/synchronization-between-c-app-and-active-directory , a user said:

'...Then let AD synchronize with SQL.'

That sounds good for me, but how can I do that?

@Pablo: So we have an existing c# application that manages users and groups in SQL. We would like this app to manage also the Active Directory. The idea is to query Active Directory (AD) directly with the application but also continue saving the information in the SQL as it does now. But I see a problem: when changes are made only in the Active Directory => SQL will not have an updated information, because we will have different data between AD and SQL.

I see you propose to query AD for changes and it can be done per access or using polling on a scheduled interval. I'm not familiar with it, could you explain me how to do that?

migrated from stackoverflow.com Feb 18 '11 at 14:46

This question came from our site for professional and enthusiast programmers.

  • /meta : I have no idea why they would think this is a SF question. I don't think there's anything at all built into either SQL or AD to do this. Anyone could build their own tools to do it, or buy something commercially, but this is purely a programming question. We probably shouldn't/can't ping-pong this question back between sites, but this is not the appropriate site for this question. – mfinni Feb 18 '11 at 14:52
1

Your best bet here is to have your application query AD for changes. You could do this per access or using polling on a scheduled interval. This can be done a number of ways and if you can provide more information on exactly what you want to accomplish I can provide you with some methods for this.

If all you want to do is update AD just use c# functions to update AD directly, dont even sync it. Googling gave me a few examples: http://social.msdn.microsoft.com/forums/en/netfxbcl/thread/729d1214-37f5-4330-9208-bc4d9d695ad0/

If you truly want to synchronize a system at the enterprise level consider Forefront Identity Manager. This can be used to synchronize different systems.

http://www.microsoft.com/forefront/identitymanager/en/us/default.aspx

0

@pablo: So we have an existing c# application that manages users and groups in SQL. We would like this app to manage also the Active Directory. The idea is to query Active Directory (AD) directly with the application but also continue saving the information in the SQL as it does now. But I see a problem: when changes are made only in the Active Directory => SQL will not have an updated information, because we will have different data between AD and SQL.

I see you propose to query AD for changes and it can be done per access or using polling on a scheduled interval. I'm not familiar with it, could you explain me how to do that?

  • First off this isnt really an answer to your question, probably best to update your post or comment on my entry. Polling can be done by running a script that checks AD vs SQL on a scheduled interval. You could do this fairly easily with c# depending on your requirements. – pablo Mar 2 '11 at 10:48
  • @pablo: Sorry, but I had problems login in, so I could only reply. How could I do this script? could you help me on that? – Priokuli Mar 2 '11 at 11:58
  • Hi Priokuli, sorry but I do not know c#. – pablo Mar 2 '11 at 12:10
  • @pablo: ok, I just thought that when you said that I could do it fairly easily with c#,you would know how to do it. Could I ask you which methods are the ones you said you can provide to me? I could google them and try this. Thanks – Priokuli Mar 2 '11 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy