First published on TECHNET on Nov 28, 2013
Authored by Santos Martinez
Hello all, ConfigNinja here trying to show you a few tips and tricks to convert your current custom reports using the new RBA(Role Based Administration) for reports.
This new feature on R2 brings lots of benefits, especially for those users that don’t need to have access to all the data within ConfigMgr and limit what you allow them to view. Read more about this here:
We are going to modify your custom report using Report Builder, Once you have the Report Builder open we will review a few things before updating your new custom report.
First let’s review one of the new reports from ConfigMgr 2012 R2, at your SSRS Website http://cmsite/reports.
Next, let’s go to Software Distribution - Collections > All resources in a specific collection click on the drop down and select edit in Report Builder.
Now that you are on Report Builder, let’s review a few details that are new on this report.
We have UserTokenSIDs and UserSIDS on the Parameters section; also we have a new Dataset call DataSetAdminID.
Let’s review the query inside the DataSetAdminID :
Now let’s review the 2 prompts that are part of my report.
@UserTokenSIDs general Configuration:
Available Values leave as default that should be NONE.
Default Values, Specify values.
The value will be an expression, click on the expression button to see the expression code.
Leave this as the default.
Let’s review @UserSIDs Prompt
On the Available Values page, leave as default wich should be NONE
Review the Default Values page and other pages but do not make changes.
Now that we understand the prompt let’s review the main Datasets of this reports and review the code.
On the DataSet1 , the code is as follow.
This T-SQL Code in the past use to be like this:
We had replaced the view for a function, and with the replace of a V_ we need to add fn_rbac_ and then after the function or view add (@UserSIDs).
Let’s take a look at the Dataset2 , here is the query inside this dataset.
From fn_rbac_FullCollectionMembership (@UserSIDs) fcm
Where fcm.CollectionID = @ID
As you can see on this query, the query had been modified to first validate the UserSIDs before displaying the report data.
Now let’s convert a custom report without Role Based Administration into using RBA.
For this, I will modify a Quick Fix Engineering Report that was created without RBA.
As you can see on this image, there is a missing Prompt and a missing data set from this report.
Plus let’s take a look at how each dataset query is writing. As you can see on this query, we are using the View and not the RBA function.
,QFE.Caption0 as ‘URL Info’
,QFE.Description0 as ‘Classification’
,QFE.HotFixID0 as ‘KB Article’
Now let’s start by adding the DataSetAdminID to the Report.
To do this go to Datasets, right click Add DataSet
In the Name Field enter: DataSetAdminID
Click Use a dataset embedded in my report:
Select the Data Source : Should be the ConfigMgr Default data source or a custom one.
In the Query enter the following query statement:
Click OK to finish the new dataset.
The dataset has been added and also a new prompt.
Let’s now modify the query on Dataset1 and Dataset2 to use the RBAC function.
Dataset1 has been changed; all I did was replace V_ to fn_rbac and add the (@UserSIDs).
Here is the updated DataSet2 .
On the parameters, move the UserTokenSIDs as the first priority.
And that’s all you will need to do to convert your custom report from non RBA to use RBA Function for reports, I hope these instructions were helpful and you can create your new reports ready for RBA. As a bonus for reading this blog post I have uploaded the template reports I used for this blog post here:
Santos Martinez – Sr. PFE – ConfigMgr and Databases
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.