Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Insert user data through power bi report database to access reports

Hi All,   I have installed one Power bi Report server in my local machine. While installation i configured the database name and can access the same database tables using SSMS.   We have one requ...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi d_gosbell,

     

    Thank you for the suggestion. I have gone through each documentation as you mentioned and finally able to set the new user with role. It works fine for the 1st user but when again i tried to add another user with same role then got below error:

     

    "A custom role cannot contain both system-level and non-system-level tasks in the same role definition. You must specify different roles for each category of tasks"

     

    Below is my code which i used so far.

     

     

    bool isPolicies = true;
                    ReportingService2010 rs = new ReportingService2010();
                    rs.Url = "http://<domainName>/ReportServer/ReportService2010.asmx";
                    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
                    var policies = rs.GetPolicies("/", out isPolicies);
                   
                    Role browserRole = new Role();
                    browserRole.Name = "System User";
                    Role[] r1 = new Role[1];
                    r1[0] = browserRole;
                    Policy po = new Policy();
                    po.GroupUserName = @"<domain>\<username>";
                    po.Roles = r1;
                    policies[0] = po;
                    rs.SetPolicies("/", policies);

     

    One more things i wanted to add here is suppose i added one user with some role and when again i am going to add some other user then in getPolicies i am getting the previously inserted user and his role instead of BuiltIN/Administrator.

     

    I tried to use my crednetials but in Policies getting the same user again.

    Please provide some suggestion based on the credentials should get only those related policies.

     

    Please suggest how do i fix this issue.

     

    Thanks,

    Vikash