powershell
30 TopicsHow to Download Paginated Reports (.rdl) in Bulk from Power BI Service?
Hi Community, I’m working with Power BI Service and we have several Paginated Reports (.rdl files) published across multiple workspaces in our tenant (using Premium capacity). I’m looking for a way to export or download all paginated reports in bulk, preferably using a PowerShell script or through the Power BI REST API. Specifically, I would like to: 1.Loop through one or more workspaces 2.Download each paginated report (.rdl) to a local folder 3.Filter reports based on data sources, such as Teradata or ODBC Questions Is there an officially supported way to download .rdl reports programmatically from the Power BI Service? Can the Power BI REST API be used to filter or identify data sources used in a paginated report (e.g., Teradata)? Are there any rate limits, constraints, or best practices when automating RDL export from multiple workspaces? Any help, code samples, or guidance would be highly appreciated! Thanks in advanceSolved3.3KViews2likes4CommentsChange data source connection strings in Power BI reports with PowerShell
Hi, I'm trying to automate PowerBI reports deployment using Azure Pipelines and PowerShell. I am able to connect to PowerBI using Connect-PowerBIServiceAccount and a service principal. I also can list workspaces and existing reports. My next task is to change the data source connections. I have been following this MS documentation https://learn.microsoft.com/en-us/power-bi/report-server/connect-data-source-apis but when I try the following: # Get report parameters $parameters = Get-RsRestItemDataModelParameters '/Infusion_Model_Auto' I get this error: Failed to create a new session to http://localhost/reports/api/v2.0/me : | The cmdlet cannot protect plain text secrets sent over unencrypted | connections. To suppress this warning and send plain text secrets over | unencrypted networks, reissue the command specifying the | AllowUnencryptedAuthentication parameter. I'm not sure what's going on, since I already have an active connection. Thanks for any help.Solved3.3KViews0likes3CommentsDownloadins as PDF a report from report server
Hi all, My user want to download a report from Report Server (so not power bi services) to pdf. He can't do this by downloading the pbix and then export to PDF because the report use live connection and my user does'nt have access to datas. I'd like to do this using a PowerShell script, but I am not allowed by my organisation to download MicrosoftPowerBIMgmt PowerShell module. I tested several PowerShell scripts found on the net without sucess. Any idea how to achieve that ? hank you in advance for your help. Regards, Alice1.2KViews0likes2CommentsExporting and importing Sharepoint Sites tenant to tenant
Hello everyone, I am still working on enabling the export and import of a SharePoint page between tenants. I've set up a SharePoint site with various security groups, flows, forms, and PowerApps linked together to collaborate. I've noticed that through Power Admin, flows and PowerApps can be saved. However, SharePoint sites cannot be saved using this method. I found the following site that has helped me a bit further: https://pnp.github.io/script-samples/spo-export-site-all-content/README.html?tabs=pnpps. It contains a PowerShell script. The issue with this script is that it exports and imports the list names but only adds the column headers for one list. Additionally, it doesn't include the SharePoint pages. From what I understand by reading the site where this code is hosted, it should be able to do so. Can anyone help me further or indicate what I might be doing wrong or suggest an alternative method? Thanks in advance! LisanneSolved2.9KViews0likes2CommentsUpdate data model role assignment (RLS) of PBI report using Powershell
Hi, I need to dynamically update Row level security of power bi report that is deployed to PBIRS. I have used powershell script to get list of users in row level security but I could not find out how to update the list or add users to RLS. here is the step that I have done: $PBIRSUrl = 'https://MyPBIRServer.com' #API to get role assignments $reportRoles = $PBIRSUrl + "/PBIReports/api/v2.0/PowerBIReports(Path='/MyReport')/DataModelRoleAssignments" #call API $result = Invoke-RestMethod -Uri $reportRoles -ContentType "application/json" -UseDefaultCredentials -Method Get #steps to update $result.value and add new user then save it to $roleAssgnmtjson $roleAssgnmtjson @{[ { "GroupUserName": "domain\User001", "DataModelRoles": ["2336b4a-e5b0-49ef-8556-62152375f005"] }, { "GroupUserName": "domain\User002", "DataModelRoles": ["2336b4a-e5b0-49ef-8556-62152375f005"] } ]} #API to update role assignments Invoke-RestMethod -Uri $reportRoles -ContentType "application/json" -Body $roleAssgnmtjson -UseDefaultCredentials -Method Put Invoke-RestMethod : The remote server returned an error: (400) Bad Request. At line:1 char:1 + Invoke-RestMethod -Uri $reportRoles -ContentType "application/json" ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand does anyone know how to fix the issue? I have also tried using $resultjson for body of put request, but same error $resultjson: { "@odata.context": "https://MyPBIRServer.com/PBIReports/api/v2.0/$metadata#Collection(Model.DataModelRoleAssignment)", "value": [ { "GroupUserName": "domain\User001", "DataModelRoles": "2336b4a-e5b0-49ef-8556-62152375f005" }, { "GroupUserName": "domain\User002", "DataModelRoles": "2336b4a-e5b0-49ef-8556-62152375f005" } ]} ThanksSolved1.2KViews0likes1CommentUsing Powershell and ReportService2010.asmx to get datasource details how to find ds path
I am using powershell and the ReportService2010.asmx endpoint to retrieve list of SSRS Reports and their dataSources from PBI Reportserver. For background, I am calling these functions created by written by Jana Sattainathan. ( I am rather new to powershell) I am able to pull reports, and for each report I can get a datasource REFerence. Bu now I am trying to call GetDataSourceContents so I can get the connectionString and other details. From the datasource object I have access to datasource reference and name, report path and name , But I think I need the path to the datasource itself. (Code below ) Can anyone help me figure out how to construct this value? OR, The GetDataSourceContents I am callin may not be the correct one? It does not show up in my "commands" window in the ISE , but it pops up when putting a . after the $reportproxy I am using which is https://MyServer.com/ReportServer/ReportService2010.asmx $Reports = Get-SSRSReport -ReportServerUri $PBIRSReportServerUri -ReportFolderPath $StartFolder foreach ($Report in $Reports){ Write-Host $Report.Name $Report.Path $Report.TypeName $DSS = Get-SSRSReportDataSource -ReportServerUri $PBIRSReportServerUri -ReportFolderPath "/AP Administrators" foreach ($DS in $DSS){ Write-Host $DS.ReportName $DS.ReportPath $DS.DataSourceName $DS.ReportPath $DS.ReportName $validObject = $reportproxy.GetDataSourceContents($DS.ReportPath) <---What should this value be? Write-Host $validObject.ConnectString -ForegroundColor Cyan } } Error Message: Exception calling "GetDataSourceContents" with "1" argument(s): "The operation you are attempting on item '/AP Administrators/Server Administration/SQL Datafeed History' is not allowed for this item type Here is a sample url to a datasource on the server , but I don't think it helps https://MyServer/Reports/manage/catalogitem/datasources/folder/subfolder/reportname?_pk=sdp2ph001.7KViews0likes1CommentSet data source credentials on Power BI Report Server through REST API to create a scheduled refresh
My task is the following: using the Power BI Report Server (PBIRS) REST API, upload an embedded report (embedded meaning that the data model is integrated in the report itself - a simple import from an SQL Server database, hence no live connection or DirectQuery etc.) to PBIRS, set the credentials (ConnectionString, Windows Authentication username and password) to access the data source (the database) and set up a daily scheduled refresh. With a Powershell script I'm able to upload the report with no problem, however complications arise when I try to set the credentials to the data source. Here is the code I currently have to accomplish this: $payload0 = ' { "Name": "Data Source test", "Description": "string", "Path": "/Valid/Path", "Type": "DataSource", "Hidden": false, "Size": 0, "ModifiedBy": "string", "ModifiedDate": "2020-01-13T15:51:04Z", "CreatedBy": "string", "CreatedDate": "2020-01-13T15:51:04Z", "IsFavorite": false, "IsEnabled": true, "ConnectionString": "valid.connection\\string", "DataModelDataSource": { "AuthType": "Windows", "SupportedAuthTypes": [ "Windows" ], "Kind": "SQL", "ModelConnectionName": "string", "Secret": "", "Type": "Import ", "Username": "myUserName" }, "DataSourceSubType": "DataModel", "DataSourceType": "SQL", "IsOriginalConnectionStringExpressionBased": false, "IsConnectionStringOverridden": false, "CredentialRetrieval": "prompt", "CredentialsByUser": { "DisplayText": "someText", "UseAsWindowsCredentials": true }, "CredentialsInServer": { "UserName": "myUserName", "Password": "myPassword", "UseAsWindowsCredentials": true, "ImpersonateAuthenticatedUser": true }, "IsReference": false } ' $restApiUri = $ReportPortalUri + "/api/v2.0/DataSources" Invoke-RestMethod -Uri $restApiUri -Method Post -Body $payload0 -ContentType "application/json" -UseDefaultCredentials -UseBasicParsing -Verbose After running the code I get a 201 Created response JSON that indicates the successful creation of the data source and its access credentials. If I check on the Manage pane of the report on PBIRS I don't see any changes made to the data sources. My next step was to set the credentials manually by entering my username and password on the report server and then executing the following code to set up a scheduled refresh: $payload1 = ' { "ParameterValues":[ ], "Description":"testSchedule", "CatalogItemPath":"/Valid/Path", "EventType":"DataModelRefresh", "Schedule":{ "Definition":{ "EndDate":"0001-01-01T00:00:00Z", "StartDateTime":"2019-01-15T02:00:00Z", "EndDateSpecified":false, "Recurrence":{ "DailyRecurrence": { "DaysInterval":1 } } } } } ' $restApiUri = $ReportPortalUri + "/api/v2.0/CacheRefreshPlans" Invoke-RestMethod -Uri $restApiUri -Method Post -Body $payload1 -ContentType "application/json" -UseDefaultCredentials -UseBasicParsing -Verbose Running this code results in the successful creation of the scheduled refresh given that I set up the credentials to the data source manually beforehand. So my question in short: how to set up the credentials (Windows Authentication and username/password) of a data source (the SQL Server connection defined by a valid ConnectionString) with the PBIRS REST API? Any help would be appreciated!Solved11KViews0likes4CommentsRefresh reports with PowerShell - PowerBI Report Server(on-premises)
Hello, we are using PowerBI Report Server and automatic reports refresh does not work. I want to use PowerShell to refresh all reports automatically. All reports are on company' server and we don't use PowerBI online at all. At the moment I click Edit on each report then refreshes it and save it again. But now i have about 25 reports and it's inconvenient to refresh each one individually. Option 1: Is it possible to use PowerShell to update reports directly on the report server. Option 2: Is it possible to use PowerShell to update reports on local PC, and then just upload them? Thanks!Solved4.2KViews0likes9CommentsUpdate Shared Datasouce for Report using PowerShell
Hello, We are in the process of migrating from SSRS to PBI-RS and have been testing reports in DEV using DEV Datasources. We have over 300 reports, that we need to switch to Production Datasources, and I've been looking for a way to do it via powershell.. As a NOOB, I'm running into issues. I downloaded the ReportingServicesTools and it looked like it would be pretty simple... NOPE... I found that I should be using the Get-RSITEMDatasource and Set-RSITEMDatasource based on my reading.. so I Ran the following: PS C:\> $dataSources = Get-RsItemDataSource -ReportServerUri 'http://powerbi.dev.sql.odnss.com/Reportserver/' -RsItem '/docket/All Timekeepers' Ran Succesfully Then I ran PS C:\> Set-RsItemDataSource -DataSource $datasources -RsItem '/AR/AR Aging' -ReportServerUri 'http://powerbi.dev.sql.odnss.com/reportserver/' I get the error below Please use Set-RsDataSource to update shared data sources! At C:\Program Files\WindowsPowerShell\Modules\ReportingServicesTools\0.0.5.0\Functions\CatalogItems\Set-RsItemDataSource.ps1:143 char:17 + ... throw "Please use Set-RsDataSource to update shared data ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Please use Set-...d data sources!:String) [], RuntimeException + FullyQualifiedErrorId : Please use Set-RsDataSource to update shared data sources! I'm not trying to update the Shared Datasource itself... I'm simply tying to update the report to use another Shared Datasouce.. What am I doing wrong?5.9KViews0likes7CommentsAzure partition refresh issue
Hi all, I am refreshing ds partitions via Azur runbooks and powershell scripts. This week I noticed that the error below appears (previously everything worked fine) This is the line that its calling: $Srv.Connect($connectionString) And the connection string: $connectionString ="Provider=MSOLAP;Data Source=$XmlaEndpoint;User ID=app:$PowerBIServiceApplicationID;Password=$PowerBIServiceApplicationKey;Persist Security Info=True;Impersonation Level=Impersonate" Do you have any suggestions why suddenly this script stoped working a week ago? Thanks in advance!436Views0likes0Comments