<?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: Service Principal + RLS + ExecuteQueries REST API in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Service-Principal-RLS-ExecuteQueries-REST-API/m-p/4805523#M62813</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;The crux&lt;/P&gt;
&lt;UL data-start="85" data-end="656"&gt;
&lt;LI data-start="85" data-end="353"&gt;
&lt;P data-start="87" data-end="353"&gt;The &lt;STRONG data-start="91" data-end="109"&gt;ExecuteQueries API explicitly says: &lt;EM data-start="131" data-end="194"&gt;“Service principals aren’t supported for datasets with RLS …” (also not supported for SSO-enabled models). That’s a blanket restriction on this API path, not just on role assignment. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="354" data-end="656"&gt;
&lt;P data-start="356" data-end="656"&gt;The &lt;STRONG data-start="360" data-end="367"&gt;RLS article says: &lt;EM data-start="382" data-end="534"&gt;“Service principals can’t be added to an RLS role. Accordingly, RLS isn’t applied for apps using a service principal as the final effective identity.” That’s about who the engine ultimately treats as the user when evaluating security. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security?utm_source=chatgpt.com" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P data-start="658" data-end="852"&gt;Put together: a service principal calling &lt;STRONG data-start="700" data-end="718"&gt;ExecuteQueries against an RLS-enabled dataset—&lt;STRONG data-start="750" data-end="802"&gt;even with &lt;CODE data-start="762" data-end="784"&gt;impersonatedUserName or &lt;CODE data-start="788" data-end="800"&gt;identities—is blocked (401). Your behavior matches the spec.&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;H2 data-start="859" data-end="905"&gt;Why do impersonation parameters exist then?&lt;/H2&gt;
&lt;P data-start="906" data-end="956"&gt;Because they’re used in &lt;STRONG data-start="930" data-end="939"&gt;other supported flows:&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL data-start="958" data-end="1742"&gt;
&lt;LI data-start="958" data-end="1316"&gt;
&lt;P data-start="961" data-end="1316"&gt;&lt;STRONG data-start="961" data-end="1016"&gt;ExecuteQueries with a &lt;EM data-start="985" data-end="991"&gt;user token (delegated auth)&lt;BR data-start="1016" data-end="1019" /&gt;If the caller is an actual Entra user (not an SP), &lt;CODE data-start="1070" data-end="1092"&gt;impersonatedUserName lets admins/testers run queries “as” another user on an RLS model. The parameter is documented on the API and is honored—&lt;EM data-start="1214" data-end="1278"&gt;but only when the API itself is allowed (i.e., not SP on RLS). &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/CODE&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="1318" data-end="1742"&gt;
&lt;P data-start="1321" data-end="1742"&gt;&lt;STRONG data-start="1321" data-end="1373"&gt;Embedding with EffectiveIdentity (GenerateToken)&lt;BR data-start="1373" data-end="1376" /&gt;In &lt;STRONG data-start="1379" data-end="1396"&gt;App-Owns-Data embedding, an SP can generate an &lt;STRONG data-start="1430" data-end="1445"&gt;embed token that carries an &lt;STRONG data-start="1462" data-end="1483"&gt;EffectiveIdentity (&lt;CODE data-start="1485" data-end="1497"&gt;identities/username/roles). RLS is then applied for that effective user when rendering embedded content. This is the supported way to do multi-tenant, per-user RLS with an SP—&lt;STRONG data-start="1662" data-end="1679"&gt;for embedding, not for ExecuteQueries. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token?utm_source=chatgpt.com" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;SPAN class=""&gt;+2&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;SPAN class=""&gt;+2&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;H2 data-start="1749" data-end="1784"&gt;Direct answers to your questions&lt;/H2&gt;
&lt;OL data-start="1786" data-end="2130"&gt;
&lt;LI data-start="1786" data-end="2037"&gt;
&lt;P data-start="1789" data-end="2037"&gt;&lt;STRONG data-start="1789" data-end="1864"&gt;Is the limitation about SPs-in-roles or SPs-with-RLS-datasets entirely?&lt;BR data-start="1864" data-end="1867" /&gt;For &lt;STRONG data-start="1871" data-end="1889"&gt;ExecuteQueries it’s the latter: &lt;STRONG data-start="1907" data-end="1963"&gt;SPs can’t call ExecuteQueries on RLS datasets at all (401), regardless of impersonation. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="2039" data-end="2130"&gt;
&lt;P data-start="2042" data-end="2130"&gt;&lt;STRONG data-start="2042" data-end="2115"&gt;What are the impersonation params for if SPs can’t use them with RLS?&lt;BR data-start="2115" data-end="2118" /&gt;They’re for:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL data-start="2131" data-end="2349"&gt;
&lt;LI data-start="2131" data-end="2201"&gt;
&lt;P data-start="2133" data-end="2201"&gt;&lt;STRONG data-start="2133" data-end="2147"&gt;User-token calls to ExecuteQueries (admin/test scenarios), and&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="2202" data-end="2349"&gt;
&lt;P data-start="2204" data-end="2349"&gt;&lt;STRONG data-start="2204" data-end="2217"&gt;Embedding via &lt;STRONG data-start="2222" data-end="2239"&gt;GenerateToken (EffectiveIdentity), which &lt;EM data-start="2267" data-end="2273"&gt;does apply RLS for the specified username. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;SPAN class=""&gt;+1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL start="3" data-start="2351" data-end="2919"&gt;
&lt;LI data-start="2351" data-end="2656"&gt;
&lt;P data-start="2354" data-end="2656"&gt;&lt;STRONG data-start="2354" data-end="2411"&gt;Any scenario where SP + impersonation works with RLS?&lt;BR data-start="2411" data-end="2414" /&gt;Yes—&lt;STRONG data-start="2418" data-end="2431"&gt;embedding with an SP that generates an &lt;STRONG data-start="2461" data-end="2476"&gt;embed token including an EffectiveIdentity (username/roles). RLS is enforced for that identity at render time. &lt;STRONG data-start="2576" data-end="2583"&gt;Not supported for SP + ExecuteQueries. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token?utm_source=chatgpt.com" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;SPAN class=""&gt;+1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P data-start="2661" data-end="2919"&gt;&lt;STRONG data-start="2661" data-end="2700"&gt;Permanent architectural limitation?&lt;BR data-start="2700" data-end="2703" /&gt;As of today (Aug 23, 2025), Microsoft’s docs still state the restriction; there’s no public roadmap indicating a change. Treat it as a hard constraint for the ExecuteQueries API.&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color="#800000"&gt;Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1338212"&gt;@KonradKolenda&lt;/a&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 23 Aug 2025 07:13:04 GMT</pubDate>
    <dc:creator>johnbasha33</dc:creator>
    <dc:date>2025-08-23T07:13:04Z</dc:date>
    <item>
      <title>Service Principal + RLS + ExecuteQueries REST API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Service-Principal-RLS-ExecuteQueries-REST-API/m-p/4805401#M62811</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm trying to understand a confusing aspect of Power BI's ExecuteQueries REST API and service principal authentication with Row-Level Security (RLS).&lt;/P&gt;&lt;P&gt;The Problem&lt;/P&gt;&lt;P&gt;I've been attempting to use service principal authentication with impersonation to query RLS-enabled datasets using the ExecuteQueries API. However, I consistently get 401 Unauthorized errors, regardless of:&lt;/P&gt;&lt;P&gt;- User permissions (workspace admin, regular user, external users)&lt;BR /&gt;- RLS role assignments (assigned users directly to RLS roles)&lt;BR /&gt;- Impersonation method (identities array vs impersonatedUserName parameter)&lt;BR /&gt;- User types (real Azure AD users vs fake usernames)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;What Works vs What Doesn't&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt;Works perfectly: Service principal + impersonation on non-RLS datasets&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":cross_mark:"&gt;❌&lt;/span&gt;Always fails: Service principal + impersonation on RLS-enabled datasets&lt;/P&gt;&lt;P&gt;For example, this request works fine on non-RLS datasets:&lt;BR /&gt;POST &lt;A href="https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/executeQueries" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/groups/{workspaceId}/datasets/{datasetId}/executeQueries&lt;/A&gt;&lt;BR /&gt;Authorization: Bearer [service_principal_token]&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"impersonatedUserName": "user@domain.com",&lt;BR /&gt;"queries": [{"query": "EVALUATE ROW(\"Price\", [Revenue])"}]&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;But the exact same request fails with 401 on RLS datasets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's where I'm getting confused. The documentation mentions different aspects of the limitation:&lt;/P&gt;&lt;P&gt;From ExecuteQueries REST API docs:&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries&lt;/A&gt;&lt;BR /&gt;"Service Principals are NOT supported for datasets with Row Level Security (RLS)"&lt;/P&gt;&lt;P&gt;From RLS documentation:&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security&lt;/A&gt;&lt;BR /&gt;"Service principals can't be added to an RLS role"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The RLS documentation specifically mentions that "service principals can't be added to an RLS role" - which sounds like the limitation is about ASSIGNING service principals TO roles.&lt;/P&gt;&lt;P&gt;But the ExecuteQueries API documentation says service principals are not supported for RLS datasets AT ALL.&lt;/P&gt;&lt;P&gt;This creates confusion: Are service principals blocked from:&lt;BR /&gt;1. Only being assigned to RLS roles directly? OR&lt;BR /&gt;2. Working with RLS datasets entirely (even with impersonation)?&lt;/P&gt;&lt;P&gt;My Understanding vs Reality&lt;/P&gt;&lt;P&gt;I thought the impersonation approach would work like this:&lt;BR /&gt;- Service principal authenticates (not assigned to any RLS role)&lt;BR /&gt;- Service principal uses impersonation to "act as" a real user&lt;BR /&gt;- Real user has proper RLS role assignments&lt;BR /&gt;- Query executes under the real user's security context&lt;/P&gt;&lt;P&gt;But this doesn't work, suggesting the limitation is broader than just "can't be added to roles."&lt;/P&gt;&lt;P&gt;Why Do Impersonation Parameters Exist?&lt;/P&gt;&lt;P&gt;If service principals fundamentally cannot work with RLS datasets, then why do these impersonation parameters exist in the ExecuteQueries API?&lt;/P&gt;&lt;P&gt;- identities array with username/roles&lt;BR /&gt;- impersonatedUserName parameter&lt;/P&gt;&lt;P&gt;These seem specifically designed for RLS scenarios, but if service principals are completely blocked from RLS datasets, what's their actual purpose?&lt;/P&gt;&lt;P&gt;Questions&lt;/P&gt;&lt;P&gt;1. Is the limitation about service principals being assigned to RLS roles, OR about service principals working with RLS datasets entirely?&lt;/P&gt;&lt;P&gt;2. What are the impersonation parameters actually for if service principals can't use them with RLS?&lt;/P&gt;&lt;P&gt;3. Are there any scenarios where service principal + impersonation works with RLS?&lt;/P&gt;&lt;P&gt;4. Is this a permanent architectural limitation or something that might be addressed?&lt;/P&gt;&lt;P&gt;My Use Case&lt;/P&gt;&lt;P&gt;I need programmatic access to RLS datasets with different user contexts for a multi-tenant application. The impersonation approach seemed perfect since I'm not trying to assign the service principal to roles - just use it to impersonate real users who have proper role assignments.&lt;/P&gt;&lt;P&gt;Any clarification on the exact scope of this limitation would be greatly appreciated!&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Related Documentation:&lt;BR /&gt;- ExecuteQueries REST API: &lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries&lt;/A&gt;&lt;BR /&gt;- Service Principal Authentication: &lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal&lt;/A&gt;&lt;BR /&gt;- Row-level Security: &lt;A href="https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Aug 2025 20:31:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Service-Principal-RLS-ExecuteQueries-REST-API/m-p/4805401#M62811</guid>
      <dc:creator>KonradKolenda</dc:creator>
      <dc:date>2025-08-22T20:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Service Principal + RLS + ExecuteQueries REST API</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Service-Principal-RLS-ExecuteQueries-REST-API/m-p/4805523#M62813</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&amp;nbsp;The crux&lt;/P&gt;
&lt;UL data-start="85" data-end="656"&gt;
&lt;LI data-start="85" data-end="353"&gt;
&lt;P data-start="87" data-end="353"&gt;The &lt;STRONG data-start="91" data-end="109"&gt;ExecuteQueries API explicitly says: &lt;EM data-start="131" data-end="194"&gt;“Service principals aren’t supported for datasets with RLS …” (also not supported for SSO-enabled models). That’s a blanket restriction on this API path, not just on role assignment. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="354" data-end="656"&gt;
&lt;P data-start="356" data-end="656"&gt;The &lt;STRONG data-start="360" data-end="367"&gt;RLS article says: &lt;EM data-start="382" data-end="534"&gt;“Service principals can’t be added to an RLS role. Accordingly, RLS isn’t applied for apps using a service principal as the final effective identity.” That’s about who the engine ultimately treats as the user when evaluating security. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/fabric/security/service-admin-row-level-security?utm_source=chatgpt.com" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P data-start="658" data-end="852"&gt;Put together: a service principal calling &lt;STRONG data-start="700" data-end="718"&gt;ExecuteQueries against an RLS-enabled dataset—&lt;STRONG data-start="750" data-end="802"&gt;even with &lt;CODE data-start="762" data-end="784"&gt;impersonatedUserName or &lt;CODE data-start="788" data-end="800"&gt;identities—is blocked (401). Your behavior matches the spec.&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;H2 data-start="859" data-end="905"&gt;Why do impersonation parameters exist then?&lt;/H2&gt;
&lt;P data-start="906" data-end="956"&gt;Because they’re used in &lt;STRONG data-start="930" data-end="939"&gt;other supported flows:&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL data-start="958" data-end="1742"&gt;
&lt;LI data-start="958" data-end="1316"&gt;
&lt;P data-start="961" data-end="1316"&gt;&lt;STRONG data-start="961" data-end="1016"&gt;ExecuteQueries with a &lt;EM data-start="985" data-end="991"&gt;user token (delegated auth)&lt;BR data-start="1016" data-end="1019" /&gt;If the caller is an actual Entra user (not an SP), &lt;CODE data-start="1070" data-end="1092"&gt;impersonatedUserName lets admins/testers run queries “as” another user on an RLS model. The parameter is documented on the API and is honored—&lt;EM data-start="1214" data-end="1278"&gt;but only when the API itself is allowed (i.e., not SP on RLS). &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/CODE&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="1318" data-end="1742"&gt;
&lt;P data-start="1321" data-end="1742"&gt;&lt;STRONG data-start="1321" data-end="1373"&gt;Embedding with EffectiveIdentity (GenerateToken)&lt;BR data-start="1373" data-end="1376" /&gt;In &lt;STRONG data-start="1379" data-end="1396"&gt;App-Owns-Data embedding, an SP can generate an &lt;STRONG data-start="1430" data-end="1445"&gt;embed token that carries an &lt;STRONG data-start="1462" data-end="1483"&gt;EffectiveIdentity (&lt;CODE data-start="1485" data-end="1497"&gt;identities/username/roles). RLS is then applied for that effective user when rendering embedded content. This is the supported way to do multi-tenant, per-user RLS with an SP—&lt;STRONG data-start="1662" data-end="1679"&gt;for embedding, not for ExecuteQueries. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token?utm_source=chatgpt.com" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;SPAN class=""&gt;+2&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;SPAN class=""&gt;+2&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;H2 data-start="1749" data-end="1784"&gt;Direct answers to your questions&lt;/H2&gt;
&lt;OL data-start="1786" data-end="2130"&gt;
&lt;LI data-start="1786" data-end="2037"&gt;
&lt;P data-start="1789" data-end="2037"&gt;&lt;STRONG data-start="1789" data-end="1864"&gt;Is the limitation about SPs-in-roles or SPs-with-RLS-datasets entirely?&lt;BR data-start="1864" data-end="1867" /&gt;For &lt;STRONG data-start="1871" data-end="1889"&gt;ExecuteQueries it’s the latter: &lt;STRONG data-start="1907" data-end="1963"&gt;SPs can’t call ExecuteQueries on RLS datasets at all (401), regardless of impersonation. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="2039" data-end="2130"&gt;
&lt;P data-start="2042" data-end="2130"&gt;&lt;STRONG data-start="2042" data-end="2115"&gt;What are the impersonation params for if SPs can’t use them with RLS?&lt;BR data-start="2115" data-end="2118" /&gt;They’re for:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL data-start="2131" data-end="2349"&gt;
&lt;LI data-start="2131" data-end="2201"&gt;
&lt;P data-start="2133" data-end="2201"&gt;&lt;STRONG data-start="2133" data-end="2147"&gt;User-token calls to ExecuteQueries (admin/test scenarios), and&lt;/STRONG&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="2202" data-end="2349"&gt;
&lt;P data-start="2204" data-end="2349"&gt;&lt;STRONG data-start="2204" data-end="2217"&gt;Embedding via &lt;STRONG data-start="2222" data-end="2239"&gt;GenerateToken (EffectiveIdentity), which &lt;EM data-start="2267" data-end="2273"&gt;does apply RLS for the specified username. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/execute-queries" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;SPAN class=""&gt;+1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;OL start="3" data-start="2351" data-end="2919"&gt;
&lt;LI data-start="2351" data-end="2656"&gt;
&lt;P data-start="2354" data-end="2656"&gt;&lt;STRONG data-start="2354" data-end="2411"&gt;Any scenario where SP + impersonation works with RLS?&lt;BR data-start="2411" data-end="2414" /&gt;Yes—&lt;STRONG data-start="2418" data-end="2431"&gt;embedding with an SP that generates an &lt;STRONG data-start="2461" data-end="2476"&gt;embed token including an EffectiveIdentity (username/roles). RLS is enforced for that identity at render time. &lt;STRONG data-start="2576" data-end="2583"&gt;Not supported for SP + ExecuteQueries. &lt;SPAN class="" data-state="closed"&gt;&lt;SPAN class="" data-testid="webpage-citation-pill"&gt;&lt;A class="" href="https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token?utm_source=chatgpt.com" target="_blank" rel="noopener"&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Microsoft Learn&lt;SPAN class=""&gt;+1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P data-start="2661" data-end="2919"&gt;&lt;STRONG data-start="2661" data-end="2700"&gt;Permanent architectural limitation?&lt;BR data-start="2700" data-end="2703" /&gt;As of today (Aug 23, 2025), Microsoft’s docs still state the restriction; there’s no public roadmap indicating a change. Treat it as a hard constraint for the ExecuteQueries API.&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;FONT color="#800000"&gt;Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/1338212"&gt;@KonradKolenda&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Aug 2025 07:13:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Service-Principal-RLS-ExecuteQueries-REST-API/m-p/4805523#M62813</guid>
      <dc:creator>johnbasha33</dc:creator>
      <dc:date>2025-08-23T07:13:04Z</dc:date>
    </item>
  </channel>
</rss>

