简体   繁体   English

SSRS REST API 嵌入式数据源凭据设置

[英]SSRS REST API Embedded Data Source Credential Settings

I have a working solution that will deploy rdl report definitions to a report server using a POST request.我有一个工作解决方案,它将使用 POST 请求将 rdl 报告定义部署到报告服务器。 These reports utilize embedded XML data sources that will include a request token for the target endpoint(s) (via https) and thusly don't need any credentials.这些报告使用嵌入式 XML 数据源,其中将包含目标端点的请求令牌(通过 https),因此不需要任何凭据。 Subsquently, the rdl files are defined to require no credentials--this required setting up An Unattended Execution Account is required to allow a report to be configured using no credentials.随后,rdl 文件被定义为不需要凭据——需要设置无人参与的执行帐户以允许不使用凭据配置报告。 The deployment of these reports is successful, however, I've run into an initial problem and a subsequent problem trying to fix the first:这些报告的部署是成功的,但是,我遇到了一个初始问题和一个后续问题,试图解决第一个问题:

1) Upon deployment, the SSRS Server is ignoring the report definition data source credential setting "Log into the data source without any credentials", and setting the data source to prompt for credentials. 1) 部署时,SSRS 服务器忽略报表定义数据源凭据设置“无需任何凭据即可登录数据源”,并将数据源设置为提示输入凭据。

2) As a workaround to the issue described in #1, I attempted to make additional API requests ( PUT ) against the /Reports(path='/folder/reportname')/DataSources endpoint, however, I'm unable to form an appropriate json object to complete the request. 2) 作为#1 中描述的问题的解决方法,我尝试针对/Reports(path='/folder/reportname')/DataSources端点发出额外的 API 请求 ( PUT ),但是,我无法形成适当的 json 对象来完成请求。

EDIT: On closer inspection of the GET responses (including a slightly doctored example below), the Id 's associated with the embedded data sources appear to be meaningless and change on every request, however, trying to address the data sources (omitting the Id ) doesn't seem to work either (I've updated the previously included sample payloads to omit the ID and include the Name of the data source, but these requests are still returning 400 Bad Request Status Codes.编辑:仔细检查GET响应(包括下面稍微修改过的示例),与嵌入数据源关联的Id似乎毫无意义,并且每次请求都会更改,但是,尝试解决数据源(省略Id ) 似乎也不起作用(我已经更新了之前包含的示例有效负载以省略 ID 并包含数据源的Name ,但这些请求仍然返回400 Bad Request状态代码。

EDIT #2: My familiarity with deploying reports via Visual Studio (SSDT) made me forget that credentials are not actually defined as part of the report, this would be undesirable as there would be, in many cases, credentials stored in source control or the report server where they could be compromised.编辑 #2:我对通过 Visual Studio (SSDT) 部署报告的熟悉让我忘记了凭据实际上并未定义为报告的一部分,这是不可取的,因为在许多情况下,凭据存储在源代码管理或报告服务器,他们可能会受到损害。 This means that I should be pursuing the secondary API call, but I have yet to successfully craft an object to pass to that endpoint as a payload, as of yet.这意味着我应该追求辅助 API 调用,但到目前为止,我还没有成功制作一个对象作为有效负载传递到该端点。

Example GET Request Response against /Reports(path='/folder/reportname')/DataSources针对/Reports(path='/folder/reportname')/DataSources GET 请求响应示例

{
  "@odata.context": "https://my-report-server.com/reports/api/v2.0/$metadata#DataSources",
  "value": [
    {
      "Id": "00000747-020f-019c-e8be-4f8ff834bee5",
      "Name": "DebugSource",
      "Description": null,
      "Path": null,
      "Type": "DataSource",
      "Hidden": false,
      "Size": 0,
      "ModifiedBy": null,
      "ModifiedDate": "0001-01-01T00:00:00Z",
      "CreatedBy": null,
      "CreatedDate": "0001-01-01T00:00:00Z",
      "ParentFolderId": null,
      "ContentType": null,
      "Content": "",
      "IsFavorite": false,
      "Roles": [],
      "IsEnabled": true,
      "ConnectionString": "https://localhost:8082/some-api-endpoint",
      "DataSourceType": "XML",
      "IsOriginalConnectionStringExpressionBased": false,
      "IsConnectionStringOverridden": false,
      "CredentialRetrieval": "prompt",
      "CredentialsByUser": {
        "DisplayText": null,
        "UseAsWindowsCredentials": false
      },
      "CredentialsInServer": null,
      "IsReference": false
    },
    {
      "Id": "000009b9-0093-0257-52cc-e93a261f0862",
      "Name": "ActualAPIEndpointForNonDevUse",
      "Description": null,
      "Path": null,
      "Type": "DataSource",
      "Hidden": false,
      "Size": 0,
      "ModifiedBy": null,
      "ModifiedDate": "0001-01-01T00:00:00Z",
      "CreatedBy": null,
      "CreatedDate": "0001-01-01T00:00:00Z",
      "ParentFolderId": null,
      "ContentType": null,
      "Content": "",
      "IsFavorite": false,
      "Roles": [],
      "IsEnabled": true,
      "ConnectionString": null,
      "DataSourceType": "XML",
      "IsOriginalConnectionStringExpressionBased": true,
      "IsConnectionStringOverridden": false,
      "CredentialRetrieval": "prompt",
      "CredentialsByUser": {
        "DisplayText": null,
        "UseAsWindowsCredentials": false
      },
      "CredentialsInServer": null,
      "IsReference": false
    }
  ]
}

JSON payload example: 1 JSON 负载示例:1

(created by modifying a json excerpt from a GET Request against /Reports(path='/folder/reportname')/DataSources ) (通过修改针对/Reports(path='/folder/reportname')/DataSourcesGET请求的 json 摘录创建)

{
  "Name": "DebugSource",
  "Description": null,
  "Path": null,
  "Type": "DataSource",
  "Hidden": false,
  "Size": 0,
  "ModifiedBy": null,
  "ModifiedDate": "0001-01-01T00:00:00Z",
  "CreatedBy": null,
  "CreatedDate": "0001-01-01T00:00:00Z",
  "ParentFolderId": null,
  "ContentType": null,
  "Content": "",
  "IsFavorite": false,
  "Roles": [],
  "IsEnabled": true,
  "ConnectionString": "https://localhost/some-endpoint",
  "DataSourceType": "XML",
  "IsOriginalConnectionStringExpressionBased": false,
  "IsConnectionStringOverridden": false,
  "CredentialRetrieval": "none",
  "CredentialsByUser": {
    "DisplayText": null,
    "UseAsWindowsCredentials": false
  },
  "CredentialsInServer": null,
  "IsReference": false
}

JSON payload example: 2 (minimal) JSON 负载示例:2(最小)

this would be the ideal form and should be valid based on api documentation这将是理想的形式,并且基于 api 文档应该是有效的

{
  "Name": "DebugSource",
  "CredentialRetrieval": "none"
}

The ideal solution here would be a setting that would force SSRS to honor the embedded data source settings, but additional REST API calls would be fine as well if I can figure out the correct syntax to use.这里的理想解决方案是强制 SSRS 遵守嵌入式数据源设置的设置,但如果我能找出要使用的正确语法,则额外的 REST API 调用也可以。

您可以使用 Reports 门户获取所需的 json,它使用 api 与 SSRS 交换数据。

I forgot to follow up on this question:我忘了跟进这个问题:

I ended up resolving this issue with Microsoft support.我最终通过 Microsoft 支持解决了这个问题。 Hitting this endpoint:命中这个端点:

http://reportserverurl/reports/api/v2.0/Reports(19489e3b-5653-466a-b242-43e4e198be49)/DataSources

With a payload like so:使用这样的有效载荷:

[{
"Name":"DataSourceUpdated",
"Description":null,
"Hidden":false,
"Path":"",
"IsEnabled":true,
"DataSourceSubType":null,
"DataModelDataSource":null,
"IsReference":false,
"DataSourceType":"SQLAZURE",
"ConnectionString":"Data Source=someting;Initial Catalog=rsadventureworks;Encrypt=True;TrustServerCertificate=False",
"IsConnectionStringOverridden":true,
"CredentialRetrieval":"store",
"CredentialsInServer":
{
"UserName":"something",
"Password":"something",
"UseAsWindowsCredentials":false,
"ImpersonateAuthenticatedUser":false
},
"CredentialsByUser":null
}
]

worked for me in my testing at the time, though I haven't yet implemented this in my deployment solution (I originally used the legacy soap api because this issue dragged on for some time).当时在我的测试中为我工作,尽管我还没有在我的部署解决方案中实现它(我最初使用的是遗留的soap api,因为这个问题拖了一段时间)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM