locked
Sql query error in Active Directory RRS feed

  • Question

  • Time Good afternoon.
    I'm trying to do a SQL query to fetch information from my AD and I am getting this error message:
    OLE DB provider 'ADsDSOObject' Reported an error. The provider Indicates that the user did not have the permission to perform the operation.
    OLE DB error trace [OLE / DB Provider 'ADsDSOObject' ICommandPrepare :: Prepare returned 0x80040e09: The provider Indicates that the user did not have the permission to perform the operation.].

    This error began to occur when it was changed where this service account could log, this setting was made the object tab AD user account and chose the option to log in ..., ai put the servers in AD and servidore SQL that account needs to login. (This was a request from the security team to configure the service accounts as well).

    What I did to try to solve the problem:
    1 - I went on a test OU and gave permission for reading my service account and the test and did nothing, I read permission to the service account on my tree of domain and nothing.

    You know what I can do to fix this?

    att;

    Marcus

    Thursday, September 6, 2012 1:11 PM

Answers

  • Hi Marcus,

    We can using this sample to query Active Directory from MS SQL Server:

    sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces', 'ADSDSOObject', 'adsdatasource'

    And then you can query linked server like this:

    SELECT * FROM OpenQuery(ADSI, 'SELECT title, displayName, sAMAccountName, givenName, telephoneNumber, facsimileTelephoneNumber, sn FROM ''LDAP://DC=whaever,DC=domain,DC=org'' where objectClass = ''User''')

    Based on your problem, I think you haven’t configure the linked server in SQL Server management studio.

    Go to properties of newly created linked server and adjust security settings (Server Objects > Linked Servers > ADSI).

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Best Regards,
    Iric
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Iric Wen Friday, September 7, 2012 8:49 AM
    • Proposed as answer by Iric Wen Thursday, September 13, 2012 4:38 AM
    • Marked as answer by Iric Wen Sunday, September 16, 2012 9:04 AM
    Friday, September 7, 2012 8:49 AM

All replies

  • Hi Marcus,

    We can using this sample to query Active Directory from MS SQL Server:

    sp_addlinkedserver 'ADSI', 'Active Directory Service Interfaces', 'ADSDSOObject', 'adsdatasource'

    And then you can query linked server like this:

    SELECT * FROM OpenQuery(ADSI, 'SELECT title, displayName, sAMAccountName, givenName, telephoneNumber, facsimileTelephoneNumber, sn FROM ''LDAP://DC=whaever,DC=domain,DC=org'' where objectClass = ''User''')

    Based on your problem, I think you haven’t configure the linked server in SQL Server management studio.

    Go to properties of newly created linked server and adjust security settings (Server Objects > Linked Servers > ADSI).

    TechNet Subscriber Support

    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.


    Best Regards,
    Iric
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    • Edited by Iric Wen Friday, September 7, 2012 8:49 AM
    • Proposed as answer by Iric Wen Thursday, September 13, 2012 4:38 AM
    • Marked as answer by Iric Wen Sunday, September 16, 2012 9:04 AM
    Friday, September 7, 2012 8:49 AM
  • Ok, I'll try to make this setting.

    Marcus
    Monday, September 10, 2012 6:34 PM