How to add SSRS users and permissions programmatically?
Hi, I want to add SSRS user and set permissions(set roles) programmatically from C#. Thanks in advance. nasayoo
August 16th, 2011 9:55am

The safest way to do this is add a user using the Reporting Services interface, then use queries to find out which IDs are assigned. Use those IDs as a template for your own. The following queries ought to get you where you want to go. I would suggest creating your policies and roles first, then use the pre-existing uniqueidentifiers found in these tables to put it all together in the PolicyUserRole table. --Get your role IDs select * from roles --Get your policy IDs select * from policies --See your UserIDs select * from users --This will return the Sid you need for the users table select suser_sid('The_userID') --This ties them all together select * from policyUserRole The insert statement whould be like the following: insert into users select newid(), suser_sid('YourNewUser'), 1, 1, 'YourNewUser' declare @NewUser uniqueidentifier select @NewUser = userid from users where username = 'YourNewUser' insert into policyUserRole select newid(), @NewUser, YourPolicyID, YourRoleID Let me know if that's what you were looking for! Randy
Free Windows Admin Tool Kit Click here and download it now
August 16th, 2011 12:09pm

That still does not grant permissions to that user. It does not show up in the security tab of any report. There is another table 'SecData' that controls who can access what. Any ideas on how data can be added/updated to this table especially the XML Description Field? Thanks, Varun
September 15th, 2011 6:46pm

Have you looked into using the Reporting Services SOAP APIs to do this? The SetPolicies API is used to grant users permissions on specific items: http://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010.setpolicies.aspx
Free Windows Admin Tool Kit Click here and download it now
September 16th, 2011 5:52am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics