Running some code that updates active directory i ran into the following error message when trying to search for a user “A referral was returned from the server“. The problem was that the LDAP query i had used the wrong DC, and not the one that the user was in.
eg. my LDAP connection was: LDAP://devdcserver01.domain.int/DC=development,DC=domain,DC=int
when it should have been: LDAP://devdcserver01.domain.int/DC=dev,DC=domain,DC=int
This was because while the ‘friendly’ name of the domain you use when logging in was “DEVELOPMENT” however the fully qualified name was dev.domain.int