sql server - TSQL: access user data from LDAP -


i have active directory (ldap) stores user information. i'm trying access using tsql, i'm having authentication problems.

the ldap looks (i edited data):

enter image description here

the user has following properties:

enter image description here

now, i'm trying info user through tsql query sql server using openrowset so:

select *  openrowset('adsdsoobject','adsdatasource'; 'domain.com.io\test';'the_sha1_pass', 'select  givenname     ''ldap://domain.com.io/ou=users,       dc=domain,dc=com,dc=io'' givenname = ''test''       ') 

but when execute following error:

server: msg 7399, level 16, state 1, line 1 ole db provider ' adsdsoobject ' reported error. provider indicates user did not have permission perform operation.

now, don't know if have send authentication of user i'm trying query over, or credentials use connect ldapadmin. , if have send it, should send pass encrypted or without encryption?

thanks.

you can change openrowset query follows removing username , password

select * openrowset('adsdsoobject','adsdatasource', 'select givenname     ''ldap://kodyaz.com/dc=kodyaz,dc=com'' givenname = ''kodyaz''       ') 

or alternative, can try following query structure

select * openquery(adsi, 'select * ''ldap://kodyaz.com/dc=kodyaz,dc=com'' objectcategory=''user'' , givenname = ''kodyaz'' ')  

i added user objectcategory in clause givenname parameter in openquery command

before running above select statement, can add ldap linked server in sql server shown in referred tutorial

exec sp_addlinkedserver 'adsi', 'active directory service interfaces', 'adsdsoobject', 'adsdatasource' 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -