PrincipalContext Validator


Developers use active directory as central source of authentication , validation and response. To perform actions on Security Principals, one have to open up the connection with the active directory domain where the application will be installed.

Programmers should use PrincipalContext to establish the connection to active directory and this is done through the constructors , properties and Methods exposed by MSDN. PrincipalContext constructor accepts 7 argument types which are listed below
http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.principalcontext.aspx

In my below tool, I am passing OU as the Container Object to perform the operations on Security Principals. Below tool can be used to validate the PrincipalContext and the Container being used, the purpose was to expose the CLASS functionality of PrincpalContext and the behavior of container property.

 

Notes:

a) Ensure you insert the DN of the Container object.
eg: In my example , I am using my OU as a container object and the syntax would be
Principalcontext ( contexttype.domain,”mydomain.com”,OU=Testing,DC=mydomain,DC=com”)

When the above code gets compiled, there is a socket which validates the DN on the Active directory provided in the Container section and returns error, if
the DN is wrong!, this gives more clarity for the developers to understand the DN before releasing the code.

b) From a tool point of view, I am accepting the input from users , but the code can be hardcoded as shown above.

 

 

 

Platform:

This tool was tested on Windows 2008 R2 and Windows Server 2012

Requirement:

.Net Framework 3.5 and above.

Input
-AD Domain

– OU DN ( eg: OU=Testing,DC=mydomain,DC=com)

Result

Tool will provide with the Domain Controller FQDN and OU DN after validation.

Download

Please rename the tool to exe post download.

PrincipalContext Domain Validator

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s