I am developing a Windows Form application. On one of the forms I display the results of a query to an Analysis Services database. I create the MDX command text by building a string.
Everything works, but users who do not have permission to access the database encounter and access error. I don't want to give all of the users permission to access the database. I want the application to use the credentials in the connection string. However, when I execute the AdomdCommand, it seems to be using the credentials of the logged on user instead of the "User ID" in the connection string.
How can I get the command to use the credentials in the connection string?
Dim cmdText As String = ""
Dim BdSalesBacklog As Decimal = 0
Dim oAdomdConnection As New AdomdConnection("Data Source=server;Catalog=PortalAnalytics;User ID=user;password=password")
Dim oAdomdCommand As AdomdCommand = New AdomdCommand()
Dim oAdomdReader As AdomdDataReader
Dim period As String = ddlPeriod.Items(0)
oAdomdCommand.CommandType = CommandType.Text
cmdText = "" & _
"SELECT " & _
"{ BNBTime.[" & period & "] } ON COLUMNS , " & _
"{ Measures.[Total Backlog Snapshot] } ON ROWS " & _
"FROM BNB "
oAdomdCommand.CommandText = cmdText
Try
oAdomdConnection.Open()
oAdomdCommand.Connection = oAdomdConnection
oAdomdReader = oAdomdCommand.ExecuteReader()
Catch ex As Exception
MessageBox.Show(Err.Description)
End Try
Do While oAdomdReader.Read()
BdSalesBacklog = oAdomdReader.GetDecimal(1)
Loop
oAdomdReader.Close()
oAdomdConnection.Close()
I called a developer friend of mine and he explained to me that SSAS requires the logged on user to have permissions in a Role in the AS database.
I created an AD group containing the users to whom I want to allow access, and I gave that group membership in a new AS Role. I assigned the role the permissions I wanted the users to have.
My application now works for all the users who need to run it.
Thanks
No comments:
Post a Comment