rest pbirs
4 TopicsSet 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!Solved11KViews0likes4CommentsWhat are the minimum rights for the caller to access REST API on Power BI Report Server?
Hi, Our on-prem PBIRS is January 2022. We are aiming to automate some routine processes and the REST API environment seems to have everything we need. We have configured WindowsNegotiate and WindowsNTLM in the ReportServer.config file. I've tried finding a documentation or some page that explains what the minimum requirements the calling user must have inside the PBIRS environment to be able to use the AP, but so far unable to find anything telling me what I need. Therefore reaching out here. So my question: What are the minimum requirements for the calling Windows user to be able to use the REST API? It seems it is allowed when adding the calling user to the Local Administrator group on the server. But I really don't want to add this user to that group just for this purpose. Is there any other way to achieve the same with less rights? Br, SörenSolved3.3KViews0likes6CommentsGet all subscriptions using REST API returning empty
Hi everyone, I am currently trying to use Powershell to call the REST API endpoint to get all subscriptions based on the following Swagger file: https://app.swaggerhub.com/apis/microsoft-rs/PBIRS/2.0#/Subscriptions/GetSubscriptions This method is currently returning zero subscriptions when I have thousands of them on the server. The method is being executed under the default credentials (my user) and I am an admin of the PBI RS portal. What am I doing incorrectly? Thank you Regards, LS1.9KViews0likes6Comments