Using SSIS AMO to mainta Cube roles

  • Hi guys I am trying to develop a script in SSIS to maintain roles on my cube.

    I have a list that comes from our CRM system of Resources, with their NT user info.

    I pass this to a VB script task that is supposed to add them if they dont exist, to a role.

    This is the VB.

    ResourceNTAccount is the imput column

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

    Imports Microsoft.AnalysisServices ' <- AMO Library'

    <Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _

    <CLSCompliant(False)> _

    Public Class ScriptMain

    Inherits UserComponent

    Dim cnt As Integer

    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

    Dim srv As New Server()

    Dim db As New Database()

    Dim role As New Role()

    Dim roleMember As New RoleMember()

    Dim dbPermission As New DatabasePermission()

    Dim cubePermission As New CubePermission()

    srv.Connect(Variables.connectionString)

    db = srv.Databases.FindByName(Variables.dbName)

    role = db.Roles.FindByName(Variables.roleName)

    roleMember = New RoleMember(Row.ResourceNTAccount)

    Try

    If Not role.Members.Contains(roleMember) Then

    role.Members.Add(roleMember)

    role.Update()

    End If

    Finally

    If srv.Connected Then

    srv.Disconnect()

    End If

    End Try

    End Sub

    End Class

    it fails with the following runtimg error:

    at Microsoft.AnalysisServices.AnalysisServicesClient.SendExecuteAndReadResponse(ImpactDetailCollection impacts, Boolean expectEmptyResults, Boolean throwIfError)

    at Microsoft.AnalysisServices.AnalysisServicesClient.Alter(IMajorObject obj, ObjectExpansion expansion, ImpactDetailCollection impact, Boolean allowCreate, XmlaWarningCollection warnings)

    at Microsoft.AnalysisServices.Server.Update(IMajorObject obj, UpdateOptions options, UpdateMode mode, XmlaWarningCollection warnings, ImpactDetailCollection impactResult)

    at Microsoft.AnalysisServices.Server.SendUpdate(IMajorObject obj, UpdateOptions options, UpdateMode mode, XmlaWarningCollection warnings, ImpactDetailCollection impactResult)

    at Microsoft.AnalysisServices.MajorObject.Update(UpdateOptions options, UpdateMode mode, XmlaWarningCollection warnings)

    at SC_183e3d3bb8e943cabe6244ebf1b0389a.vbproj.ScriptMain.Input0_ProcessInputRow(Input0Buffer Row)

    at SC_183e3d3bb8e943cabe6244ebf1b0389a.vbproj.UserComponent.Input0_ProcessInput(Input0Buffer Buffer)

    at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer)

    any ideas what i'm doing wrong and how i can fix it?

    thanks a mil

    Ian Cockcroft
    MCITP BI Specialist

  • Is there nothing else returned? It doesn't look like you've pasted the error, just the call stack (ie SSAS telling you where in the stack the error occurred).

    Steve.

  • Hi Stev, sorry. never got that far.

    [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Script Component 1" (212) failed with error code 0x80131500 while processing input "Input 0" (214). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.

    think I have more to work with. Thought it was AS failing.

    Ian

    Ian Cockcroft
    MCITP BI Specialist

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply