Quantcast
Channel: All about Microsoft Endpoint Manager
Viewing all articles
Browse latest Browse all 444

SCCM Configmgr 2012 How to change Custom Data source to Shared Data Source for multiple SSRS reports

$
0
0

Background: I had a requirement to not allow others except Configmgr admins to deny access to Configmgr 2012 Console, also to Configmgr SQL Database access (this can be done by revoking access from SSRS_Read Group.If the users are part of this group,they can install SQL and try to connect to configmgr database remotely to run queries).How do we provide access to service Desk /Others to access reports In General? Create AD security group,add this group to SMS Admins (to get access to the SMS Provider) on Configmgr server,Create new Security role in Configmgr by providing Run report permissions and add the AD sec group to administrative users by selecting the above created security scope.

So far,everything is fine but the problem here is,we usually create SSRS reports using custom tools like Business intelligence studio(Visual Studio) .

so during the process of new Report creation,we mostly go with Data  source connection string as ‘Data Source=SQLserverName;Initial Catalog=DatabaseName’. once you are done with reports,we publish them to SSRS by Uploading the RDL file or auto publish from BIDS. How to publish the custom reports to specific folder in SSRS available here

what happens when end users browse these reports ? they get access denied since they are not allowed to connect to SQL server(they are not part of SSRS_Read group) ,what is used in above Reports. So you are required to change the Data source to Shared Data source(default Data source for Configmgr). 

image thumb3 SCCM Configmgr 2012 How to change Custom Data source to Shared Data Source for multiple SSRS reports

For single report,you can do this by going to report properties—data source and select the Shared Data source from Configmgr_P01 as shown below:

image thumb4 SCCM Configmgr 2012 How to change Custom Data source to Shared Data Source for multiple SSRS reports

But what,if you want to do this change for multiple custom reports ,manual method is not preferable.

Here is the powershell script to change form Custom Data Source to Share data source for multiple reports under specific folder.

#Set variables:
#Change the Configmgr Report server name
$reportserver = "sccm2012pri";
$url = "
http://$($reportserver)/reportserver/reportservice2005.asmx?WSDL";
#Provide New Data source Path ,you need to replace this with correct one from your SSRS report
$newDataSourcePath = "/ConfigMgr_P01/{5C6358F2-4BB6-4a1b-A16E-8D96795D8602}"
#Provide new Data source Name which is part of above source path
$newDataSourceName = "{5C6358F2-4BB6-4a1b-A16E-8D96795D8602}";
# provide Report folder path that contains reports to change the Data source.in my case,i want to change DS for all reports under eskonr/eswar/sup folder.If you have multiple folders to change the Data source,you need to run the script by changing the folder name .
$reportFolderPath = "/eskonr/eswar/SUP"
#————————————————————————
$ssrs = New-WebServiceProxy -uri $url -UseDefaultCredential
$reports = $ssrs.ListChildren($reportFolderPath, $false)
$reports | ForEach-Object {
$reportPath = $_.path
Write-Host "Report: " $reportPath
$dataSources = $ssrs.GetItemDataSources($reportPath)
$dataSources | ForEach-Object {
$proxyNamespace = $_.GetType().Namespace
$myDataSource = New-Object ("$proxyNamespace.DataSource")
$myDataSource.Name = $newDataSourceName
$myDataSource.Item = New-Object ("$proxyNamespace.DataSourceReference")
$myDataSource.Item.Reference = $newDataSourcePath
$_.item = $myDataSource.Item
$ssrs.SetItemDataSources($reportPath, $_)
Write-Host "Report’s DataSource Reference ($($_.Name)): $($_.Item.Reference)";
}
Write-Host "————————"
}

I have also attached the powershell script here for your reference, incase of any syntax errors.

Note: replace the quotes as blog converts them to fancy.

Bold letters refers require change.

Hope it helps others who wants to change the Custom Data source to Shared Data source.

SCCM Configmgr 2012 How to change Custom Data source to Shared Data Source for multiple SSRS reports is a post from: Eswar Koneti's Blog


Viewing all articles
Browse latest Browse all 444

Trending Articles