Showing posts with label ADLDS. Show all posts
Showing posts with label ADLDS. Show all posts

Saturday, April 25, 2015

Where are the ADLDS/ADAM .LDF files?

If you are looking for the .LDF files that ADLDS/ADAM uses to import the various schemas while initially setting up an instance of ADLDS, you can find the various .LDF files (such as MS-User.LDF) in the following directory:

C:\Windows\ADAM

These .LDF files can give you an idea on how to compose your very own custom .LDF files as well as provide you with a better understanding of how the .LDF files work.

Configuring Active Directory Lightweight Directory Services (ADLDS) with SSL

I was recently attempting to set up an instance of ADLDS with SSL using a Self-Signed Certificate when I got this error message in my Windows System Event Logs:

Schannel
The SSL server credential's certificate does not have a private key information property attached to it. This most often occurs when a certificate is backed up incorrectly and then later restored. This message can also indicate a certificate enrollment failure.

I attempted to follow this article on how to set up LDAP over SSL: http://social.technet.microsoft.com/wiki/contents/articles/2980.ldap-over-ssl-ldaps-certificate.aspx 

I even took a look at this article to see if it would provide additional insight: https://support.microsoft.com/en-us/kb/321051

Of course, this article looked the most comprehensive in terms of guidance: https://msdn.microsoft.com/en-us/library/cc725767%28v=ws.10%29.aspx

However, none of these articles got me any further than I was before!

As it turned out, my ADLDS instance was using a non-standard port of 5001, therefore, I found this article about required ports for ADLDS with SSL: https://technet.microsoft.com/en-us/library/dd772723%28v=ws.10%29.aspx

Based on the above MSDN Article, I could only use SSL with ADLDS on port 636!!  No other port would work!!

Well, I decided to reinstall my ADLDS instance to use the standard ports of 389 and 636 and once again re-applied my SSL certificate.

As you can probably already guess, this resolved my problem!! I was using a port number that did not support SSL (LDAPS) all along!!

Friday, April 24, 2015

ASP.NET Forms Authentication with Active Directory Lightweight Directory Services (ADLDS)

Setting up ASP.NET Forms Authentication with Active Directory is relatively easy, however, I had a recent requirement to support Active Directory Lightweight Directory Services (ADLDS).

Unfortunately, it is very difficult to find information about how to provide connection string information for ADLDS.

After searching far and wide on the Internet, I finally found a reference on how to do this through Google Books: https://books.google.com/books?id=Qt3TeJJkG5oC&pg=PA510&lpg=PA510&dq=adam+asp.net+connection+string&source=bl&ots=b07V6YlxOI&sig=yxN5oMyXlzgX7LBDhkHoqpWi1rc&hl=en&sa=X&ei=3lM3VY3RLLLgsAT564Ew&ved=0CDAQ6AEwAw#v=onepage&q=adam%20asp.net%20connection%20string&f=false

Though it references the older name of ADAM, the connection string information remains the same for ADLDS:

<connectionStrings>

   <add name="adamConnection" connectionString="LDAP://localhost:389/OU=ApplicationUsers,O=MyOrganization,DC=corsair,DC=com"/>

</connectionStrings>







<membership defaultProvider="adamprovider">

   <providers>

     <add

        name="adamprovider"

        type="System.Web.Security.ActiveDirectoryMembershipProvider"

        connectionStringName="adamConnection" connectionProtection="None" attributeMapUsername="userPrincipalName"

        connectionUsername="CN=ApplicationUsersAdministrator,OU=PartitionUserAccounts,O=MyOrganization,DC=corsair,DC=com"

        connectionPassword="pass!word1" />

   </providers>

 </membership>


If you want to use an instance of ADLDS that is secured with SSL, then the information remains largely the same:




<connectionStrings>
   <add name="adamConnection" connectionString="LDAP://localhost:636/OU=ApplicationUsers,O=MyOrganization,DC=corsair,DC=com"/>
</connectionStrings>



<membership defaultProvider="adamprovider">
   <providers>
     <add
        name="adamprovider"
        type="System.Web.Security.ActiveDirectoryMembershipProvider"
        connectionStringName="adamConnection" connectionProtection="Secure" attributeMapUsername="userPrincipalName"
        connectionUsername="CN=ApplicationUsersAdministrator,OU=PartitionUserAccounts,O=MyOrganization,DC=corsair,DC=com"
        connectionPassword="pass!word1" />
   </providers>
 </membership>

Notice that the LDAP connection changes only by the port number to 636, but still does not support LDAPS.

 

For the Membership Provder, the only attribute that changes is connectionProtection from “None” to “Secure”


Of course, the ApplicationUsersAdministrator account has to be a member of the Administrators group in ADLS in order for this to work (You can do this using ADSI Edit), however, once you have that set up you should be able to use ASP.NET Forms Authentication with ADLDS in much the same way as a normal Active Directory installation!


Saturday, April 18, 2015

Managing Users in Active Directory Lightweight Directory Services using ADSIEdit

If you want to manage users for your Active Directory Lightweight Services instance using ADSIEdit, you may refer to these MSDN articles:

Manage an AD LDS Instance Using ADSI Edit
https://technet.microsoft.com/en-us/library/cc794959%28v=ws.10%29.aspx


Use ADSI Edit to Manage an AD LDS Instance https://technet.microsoft.com/en-us/library/cc731156.aspx

These articles will provide you with the necessary information to connect to your ADLDS instance using ADSIEdit, but what if you want to actually add users to ADLDS?

Well, this article addresses that question:

Add an AD LDS User to the Directory https://technet.microsoft.com/en-us/library/cc772194.aspx

The problem with  the above article, though, is that it does not address how to Set the Password for the newly created user!!

Fortunately, someone else wrote an article describing how to accomplish this (though a bit outdated):
http://sureshatt.blogspot.com/2012/06/using-adsiedit-tool-with-active.html

Once you have created your new user in ADLDS, you simply right click on the user and select "Reset Password"!







In addition, even after resetting the password, the user in ADLDS, by default, is still not enabled!  So you still have to go about enabling the user account by updating the msDS-UserAccountDisabled attribute:








Finally, the userPrincipalName attribute is still not set by going through the wizard, so that also has to be set manually:





Fortunately, there is a much easier way to accomplish all of these manual steps in ADSI Edit by using PowerShell:
[CmdletBinding()]
Param(
 [Parameter(Mandatory=$true,Position=1)]
[string]$ADName,
[Parameter(Mandatory=$true)]
[string]$ADUPN,
[Parameter(Mandatory=$true)]
[string]$ADGivenName,
[Parameter(Mandatory=$true)]
[string]$ADSurname
)
 
#Example
#ADName John Doe
#GivenName John
#Surname Doe
#UPN jdoe@adlds.com
 
$ADLDSServer = "MYADLDSServer:5000";
$ADDefaultPwd = "P@ssword!";
$ADLDSPath = "CN=Roles,CN=AppPartition,DC=ADLDS,DC=COM";
 
Clear-Host
New-ADUser -Name $ADName -DisplayName $ADName -Server $ADLDSServer -UserPrincipalName $ADUPN -GivenName $ADGivenName -Surname $ADSurname -AccountPassword (ConvertTo-SecureString $ADDefaultPwd -AsPlainText -Force) -Enabled $true -PasswordNeverExpires $true -Path $ADLDSPath

 

Using PowerShell to create ADLDS Users is definitely much, much nicer and simpler!!






Saturday, January 10, 2015

Setting up Active Directory Lightweight Directory Services

If you have a need for using some capabilities of Active Directory within your application but do not want to have to set up a Domain Controller every time that you want to set up your application (especially in a multi-tenant hosting environment), then Active Directory Lightweight Directory Services (ADLDS) is probably for you!!

For an overview of ADLDS, you can read here: http://technet.microsoft.com/en-us/library/cc754361.aspx

For additional details about how to set up and install ADLDS, you can read here: http://technet.microsoft.com/en-us/library/cc770639%28v=ws.10%29.aspx

Below are screenshots on how to install and configure ADLDS on Windows Server 2012 R2:





















Of course, if you accidentally make a mistake while creating your instance of ADLDS, you can easily remove it by simply uninstalling it via Add/Remove Programs: http://technet.microsoft.com/en-us/library/cc794886%28v=ws.10%29.aspx