Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi all
We are using PBIRS (latest release). I am a report developer and I am being asked to compile a list of username and connect strings, and eventually I'd like to be able to modify the username as well. It seems as if using an API is the best approach and I don't have much experience but I have created 2 scripts (below) and looking for general feedback.
My requirements are to Retrieve a list of ALL Datasources ( of all 3 types ) with Connectstring and userID
I have built 2 powershell scripts as follows
(REST, I believe)
$ReportServerURI = "<Reportserverserver>/Reports/"
$session = New-RsRestSession -ReportPortalUri $ReportServerURI;
$rsItems = Get-RsFolderContent -RsFolder $startingFolder -ReportServerUri $ReportServerURI -Recurse | Where-Object -Property "TypeName" -In "PowerBIReport", "Report";
foreach ($rsitem In $rsItems )
$rds = Get-RsRestItemDataSource -WebSession $session -RsItem $rsitem.Path;
foreach ($d in $rds)
{
$DataSourceUser = $d.DataModelDataSource.Username
$datasourceConnectString = $d.DataModelDataSource # I notice the connectstring is in here, so I think I can parse it out.
This returns most of the fields for Power BI reports, but I was unable to find the values for paginated
(Old SOAP API?)
$uri = "Reportserver//ReportServer/ReportService2010.asmx?WSDL" }
$reporting = New-WebServiceProxy -uri $uri -UseDefaultCredential -namespace "ReportingWebService"
$reports = $reporting.ListChildren($startingFolder, $True) | Where-Object {$_.TypeName -eq "Report"}
foreach($report in $reports)
{ $reportpath = $report.Path
$dataSources = $reporting.GetItemDataSources($report.Path)
foreach($dataSource in $dataSources)
$DataSourceUser = $dataSource.Item.UserName
$datasourceConnectString = $dataSource.Item.ConnectString
This one seems to get most of the Paginated but not much on the PBI side..
I have read quite a few posts with code samples etc. regarding datasource information but wondering if anyone can explain whether one or the other API should be used for both (noteven sure about shared connections) or if it's possible to get Connectstring/username for both types of report (preferably shared also)
Any information or links are appreciated.
Hi @IbisRipley ,
Seems a bit tricky, see if a similar solution helps you.
asp.net - Is it possible to change the username with the Membership API - Stack Overflow
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.