<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Forbidden error - while generating embed token with RLS and DirectQuery (SQL server) in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989663#M40469</link>
    <description>&lt;P&gt;datasourceIdentities is only relevant when you have a data source with sso enabled. If you don't have such then you don't need to provide your data sources in the request. Just leave it empty&lt;/P&gt;</description>
    <pubDate>Tue, 27 Dec 2022 07:31:14 GMT</pubDate>
    <dc:creator>AmosHersch</dc:creator>
    <dc:date>2022-12-27T07:31:14Z</dc:date>
    <item>
      <title>Forbidden error - while generating embed token with RLS and DirectQuery (SQL server)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2983930#M40432</link>
      <description>&lt;P&gt;* We are trying to generate embed token for a powerbi document which was RLS enabled and DirectQuery based (SQL server).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are using this below API to generate embed token&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;POST -&amp;nbsp;&lt;A target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/groups/&amp;lt;groupId&amp;gt;/reports/&amp;lt;reportId&amp;gt;/generatetoken&lt;/A&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;Payload&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "accessLevel": "View",
    "identities": [{
        "username": "&amp;lt;email&amp;gt;",
        "roles": ["Custom Role"],
        "datasets": ["&amp;lt;id&amp;gt;"]
    }]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Response:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. If the powerbi report using&lt;FONT size="4"&gt; &lt;STRONG&gt;import query&lt;/STRONG&gt; with &lt;STRONG&gt;RLS&lt;/STRONG&gt;&lt;/FONT&gt;, it provides embed token&lt;/P&gt;&lt;P&gt;2. If the powerbi report using&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;&lt;FONT size="4"&gt;DirectQuery with RLS&lt;/FONT&gt;&lt;/STRONG&gt;, it throws &lt;FONT size="4"&gt;&lt;STRONG&gt;&lt;EM&gt;403 forbidden&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt; error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you please help us to resolve?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 05:18:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2983930#M40432</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-23T05:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Forbidden error - while generating embed token with RLS and DirectQuery (SQL server)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2985883#M40444</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you to try refer to this offical blog. There is an example about how to generate embed for direct query report.&lt;/P&gt;
&lt;P&gt;For reference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token#example-of-generating-an-embed-token-for-a-power-bi-report-with-a-dataset-which-is-connected-with-directquery-to-another-power-bi-dataset.-all-related-dataset-ids-must-be-specified-in-the-request-with-'xmlapermissions'-set-to-'readonly'.-identityblobs-for-all-sso-enabled-data-sources-must-be-provided-in-the-'datasourceidentities'-array" target="_blank"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token#example-of-generating-an-embed-token-for-a-power-bi-report-with-a-dataset-which-is-connected-with-directquery-to-another-power-bi-dataset.-all-related-dataset-ids-must-be-specified-in-the-request-with-'xmlapermissions'-set-to-'readonly'.-identityblobs-for-all-sso-enabled-data-sources-must-be-provided-in-the-'datasourceidentities'-array&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you may refer to below blogs to learn more details about how to generate embed token.&lt;/P&gt;
&lt;P&gt;For reference:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/generate-embed-token" target="_self"&gt;Generate an embed token&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/cloud-rls" target="_self"&gt;Embed a report with cloud-based RLS&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 07:41:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2985883#M40444</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-23T07:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Forbidden error - while generating embed token with RLS and DirectQuery (SQL server)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2985929#M40446</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply. In my powerbi document, we are not using azure SQL, we are using our own instance of SQL server.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "datasets": [
    {
      "id": "123..",
      "xmlaPermissions": "ReadOnly"
    }
  ],
  "reports": [
    {
      "id": "235.."
    }
  ],
  "datasourceIdentities": [
    {
      "datasources": [
        {
          "datasourceType": "Sql",
          "connectionDetails": {
            "server": "...test.database.windows.net",
            "database": "testdb"
          },
          "datasourceId": "13d...c",
          "gatewayId": "ca1...4"
        }
      ]
    }
  ]
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.powerbi.com/v1.0/myorg/GenerateToken", requestOptions)
  .then(response =&amp;gt; response.text())
  .then(result =&amp;gt; console.log(result))
  .catch(error =&amp;gt; console.log('error', error));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got below error&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "error": {
        "code": "InvalidRequest",
        "message": "Datasource identity must contain identity blob"
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But in the powerbi document, the description of the indentityBlob is like below&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;`&lt;SPAN&gt;A blob for specifying an identity. Only supported for datasets with a DirectQuery connection to Azure SQL`&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;In my case i am not using AZURE sql. Can you please help us here?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 08:07:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2985929#M40446</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-23T08:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Forbidden error - while generating embed token with RLS and DirectQuery (SQL server)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989594#M40467</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please reply for my issue (my previous reply)?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 06:33:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989594#M40467</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-27T06:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Forbidden error - while generating embed token with RLS and DirectQuery (SQL server)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989663#M40469</link>
      <description>&lt;P&gt;datasourceIdentities is only relevant when you have a data source with sso enabled. If you don't have such then you don't need to provide your data sources in the request. Just leave it empty&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 07:31:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989663#M40469</guid>
      <dc:creator>AmosHersch</dc:creator>
      <dc:date>2022-12-27T07:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Forbidden error - while generating embed token with RLS and DirectQuery (SQL server)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989709#M40470</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/278935"&gt;@AmosHersch&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried the `identityBlob` as empty string, but i got below error again&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "error": {
        "code": "InvalidRequest",
        "message": "Datasource identity must contain identity blob"
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 27 Dec 2022 08:05:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989709#M40470</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-27T08:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Forbidden error - while generating embed token with RLS and DirectQuery (SQL server)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989744#M40471</link>
      <description>&lt;P&gt;You shouldnt send datasourceIdentities array at all&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 08:26:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/2989744#M40471</guid>
      <dc:creator>AmosHersch</dc:creator>
      <dc:date>2022-12-27T08:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Forbidden error - while generating embed token with RLS and DirectQuery (SQL server)</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/3004996#M40608</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where can i find the identityBlob? What is&amp;nbsp;&lt;SPAN&gt;Microsoft.PowerBI.ServiceContracts.Api.V1.IdentityBlob?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;can you help me how to get identityBlob?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "error": {
        "code": "BadRequest",
        "message": "Bad Request",
        "details": [
            {
                "message": "Error converting value \"eyJ__fQ.ey__NH0.kvW__FSjg\" to type 'Microsoft.PowerBI.ServiceContracts.Api.V1.IdentityBlob'. Path 'identities[0].identityBlob', line 30, position 1295.",
                "target": "request.identities[0].identityBlob"
            }
        ]
    }
}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 06 Jan 2023 06:08:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Forbidden-error-while-generating-embed-token-with-RLS-and/m-p/3004996#M40608</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-06T06:08:15Z</dc:date>
    </item>
  </channel>
</rss>

