Adding a user with a role to SSRS report
In this recipe, we will add a user with a few roles to SSRS.
Getting ready
In this recipe, we will add QUERYWORKS\tstark
as a browser and Content Manager to the customer list report.
For your environment, you can identify a user you want to add to an existing report and which roles you want to assign to them.
How to do it...
Let's explore the code required to add a user with a role to SSRS:
- Open PowerShell ISE as an administrator.
- Add the following script and run it:
$reportServerUri = "http://localhost/ReportServer/ReportService2010.asmx" $proxy = New-WebServiceProxy -Uri $reportServerUri -UseDefaultCredential $type = $Proxy.GetType().Namespace $itemPath = "/Customer Reports/Customer List" #this will hold all the group/users for a report $newPolicies = @() $inherit = $null #list current report users $proxy.GetPolicies($itemPath, [ref]$inherit) #NOTE that when we change policies, it will #automatically break inheritance #ALSO...