Search code examples
sql-serverssasadomd.net

Connecting to SQL Server Analysis with a windows user


How can you impersonate a windows user in a connection to an analysis server - using ADOMD.NET?

Webserver is next to Analysis server, but they are not in a domain. The webservice running on the webserver needs to access the analysis server as a specific windows account.

Is there something I can put in the connection string, or do I need to look into some kind of impersonation?


Solution

  • Try using the Impersonator class at:

    http://www.codeplex.com/OlapPivotTableExtend/SourceControl/changeset/view/23587#288650

    You call it by doing:

    using (new Impersonator(sUsername, sDomain, sPassword))   
    {   
      AdomdConnection connCube = new AdomdConnection(sConnectionString);   
      connCube.Open();   
      //etc   
    }  
    

    The original reference for this information is:

    http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/b35ab490-9a47-4312-b9b1-c22df2348356

    I don't want to take credit for someone elses information directly.