Forum Discussion
Insert user data through power bi report database to access reports
- Anonymous6 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
So first off you should NEVER manually insert data into the underlying SQL database, this is not a supported way of adding users. You should either use the user interface through the PBIRS portal or use the powershell or REST apis. We typically do not add a lot of individual users, we normally get an AD group setup, then add that group to the portal, then you just add/remove people from the AD group to control access. If everyone in your organization should be able to access the reports you can even add one of the built-in groups like "Domain Users"
Hi d_gosbell,
Thank you for the suggestion.
i have gone through the swagger api where all the api is mentioned and found one forums questions also to manager users using api. But did not get the specific way mentioned like what api url could you to insert user for the role so that he can access the Power bi reports without authentication?
Please suggest me to get the api url with the steps so that i can use it accordingly.
Thanks,
Vikash
- d_gosbell6 years agoSuper User
Yes you are right the ability to set security seems to be missing from the REST API, this means that you would need to use the Web Service endpoint instead. (see https://docs.microsoft.com/en-us/sql/reporting-services/report-server-web-service/accessing-the-soap-api?view=sql-server-ver15)
Have you looked at the PowerShell option? The ReportingServicesTools module https://github.com/microsoft/ReportingServicesTools has a Grant-RsCatalogItemRole function which will allow you to grant access to reports or folders (and you can see from the source code that it uses the web service api to do this)
- Anonymous6 years agoNot applicable
Hi d_gosbell,
Thank you for the suggested link, I have gone through each link but no idea how to start.
For testing purpose i used the reporting service web url in postman and verified like in below screen shot:
As you can see in above screen shot i have tried to access Report server using web service where i have given my report server domain. and used NTLM authentication where i passed my windows credentials but still getting Unauthorized access.
Kindly provide some example or steps which i could use to add new user through web service and provide the role for him to access Power bi report.
- Anonymous6 years agoNot applicable
Hi d_gosbell,
I access the reporting server web service through web browser and got all the service in xml format.
Could you please let me know in this xml which element i could use to insert new user and assign the specific role?
Thanks,
Vikash