<?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: Is it possible to have a Service Principal add itself as workspace Member ? in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3640420#M48782</link>
    <description>&lt;P&gt;Well of course, that endpoint API adds an SP to a Workspace, but you can only call it with your own identity, or you can call it with an SP identity only if the SP you're using is already a member of the workspace.&lt;/P&gt;&lt;P&gt;That's what I wanted to communicate when I wrote :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;- Calling the regular non-admin API endpoint to perform the same ends with an error too, indicating that the workspace doesn't exist or I don't have permissions on it. Which is true since the SP is not (yet) a member of the workspace...&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your answer though&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jan 2024 08:15:09 GMT</pubDate>
    <dc:creator>Yasston</dc:creator>
    <dc:date>2024-01-16T08:15:09Z</dc:date>
    <item>
      <title>Is it possible to have a Service Principal add itself as workspace Member ?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3638583#M48759</link>
      <description>&lt;P&gt;Hi, I'm trying to have Service Principal add itself as a Workspace member (or Contributor or whatever other AccessRight) using the PBI REST API. I'm working on a "normal" PBI Premium capacity.&lt;/P&gt;&lt;P&gt;The SP is Fabric Admin in Azure Tenant. The SP has been created following MS documentation. The SP doesn't have any 'Admin consent' permissions, but has all the other necessary ones. Eveything else on the PBI tenant is configured correctly, I can do a lot of operations with this SP, so everything seems to be working as it should. Except that I just can't perform an "add workspace user" call when the SP is not already a member of the workspace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- This blog post seems to indicate that an SP cannot call the Admin REST API "&lt;SPAN&gt;AddUserAsAdmin (Groups)"&lt;/SPAN&gt; :&amp;nbsp;&lt;A href="https://bennidejagere.com/tag/administration/" target="_blank" rel="noopener"&gt;Administration Archives - Benni De Jagere&lt;/A&gt;&amp;nbsp;(See question number 6).&lt;/P&gt;&lt;P&gt;It seems to rightly point out that&amp;nbsp;&lt;SPAN&gt;AddUserAsAdmin (Groups) cannot be considered a "read-only" API call, and hence MS is not allowing us to call it without a user delegated permission...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Calling the regular non-admin API endpoint to perform the same ends with an error too, indicating that the workspace doesn't exist or I don't have permissions on it. Which is true since the SP is not (yet) a member of the workspace...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;- But I found several disturbing things online that suggest that this can be done somehow :&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;This paid software seems to be able to work in the context of an SP (only), and seems to be able to add itself in a workspace :&amp;nbsp;&lt;A href="https://www.powerbisentinel.com/creating-a-service-principal-and-connecting-to-power-bi/" target="_blank" rel="noopener"&gt;Creating a Service Principal and Connecting to Power BI - Power BI Sentinel&lt;/A&gt; . They litterally write :&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;&lt;EM&gt;With this option enabled, this fall back is disabled, and only the Service Principal will be used. If it does not have appropriate access then there may be a gap in your lineage.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Note that this situation can be avoided with the next option below.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;&lt;EM&gt;Grant Service Principal "Contributor" access to all workspaces automatically&lt;/EM&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;This is strongly recommended to be enabled.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;The Service Principal can only gather lineage and take backups etc. if it has at least 'Contributor' permissions to all workspaces.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;You can either grant this yourself manually, or with this option enabled, The Service Principal can grant itself the permissions.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;This means that it will always have the correct permissions, even for new workspaces when they're created, without any manual admin. This will ensure that Sentinel always provides you with a full complete picture of your estate.&lt;/EM&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;This article suggests that it can be done also, but looking at the code, the connection to Power BI is made with a user context :&amp;nbsp;&lt;A href="https://www.sqlchick.com/entries/2018/12/1/how-permissions-work-for-a-power-bi-service-administrator?rq=Add-PowerBIWorkspaceUser" target="_blank" rel="noopener"&gt;How Permissions Work for a Power BI Service Administrator — SQL Chick&lt;/A&gt; In the article Sqlchick mentions :&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;The interesting part of the above example is that my Power BI administrator account does *not* have any direct permissions to the workspace. However, the organization scope allows it to be done.&lt;BR /&gt;&lt;BR /&gt;You know what else is interesting? &lt;STRONG&gt;&lt;EM&gt;That same Power BI administrator could assign permission to themselves in order to access the app workspace content.&lt;/EM&gt;&lt;/STRONG&gt; This is very important to realize because it essentially makes all data throughout the organization available to the administrator should they deem it necessary (or if they wish to do something nefarious).&lt;/PRE&gt;&lt;P&gt;I of course tried with her code, and using (or not using) the -Scope Organization argument doesn't change anything if you're trying to Connect- to PBI with an SP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;An Azure DevOps marketplace extension called "Power BI Actions" (which seems amazing) offers a function to add an SP as a Workspace member in a CI Pipeline. I installed the extension, configured the pbi service connection with my admin SP, but a test shows that it also doesn't work if the admin SP doesn't have access to the workspace prior. This extension never explicitly says that what I want to do is possible, but it has loads of examples where somebody first calls a function to create a Workspace (which is also possible with the extension), and then performs some other actions on it. How can that be possible, if on the newly created workspace the SP has not been made a member yet ? Is it because the workspace is created with the same SP, and has automaticcally been added as its Admin ?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I am trying to do this to fully automate a certain number of things on Power BI items, and it seems that almost anything you want to do in the context of an SP needs to have that SP to be (at least) Member of the workspace.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I spent a few days on this already, and I'm out of options ^^ Any help to get a definitive answer on can this be done without user permission delegation would be greatly appreciated !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 09:50:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3638583#M48759</guid>
      <dc:creator>Yasston</dc:creator>
      <dc:date>2024-01-15T09:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have a Service Principal add itself as workspace Member ?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3640326#M48777</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/674623"&gt;@Yasston&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can try this example of the rest API for Add Group member, changing the parameter from admin to member.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/groups/add-group-user" aria-label="Link Groups - Add Group User - REST API (Power BI Power BI REST APIs) | Microsoft Learn" target="_blank"&gt;Groups - Add Group User - REST API (Power BI Power BI REST APIs) | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vyangliumsft_0-1705389250487.jpeg" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1026010i77E37B3629A25037/image-size/large?v=v2&amp;amp;px=999" role="button" title="vyangliumsft_0-1705389250487.jpeg" alt="vyangliumsft_0-1705389250487.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;POST &lt;A href="https://api.powerbi.com/v1.0/myorg/groups/f089354e-8366-4e18-aea3-4cb4a3a50b48/users" aria-label="Link https://api.powerbi.com/v1.0/myorg/groups/f089354e-8366-4e18-aea3-4cb4a3a50b48/users" target="_blank"&gt;https://api.powerbi.com/v1.0/myorg/groups/f089354e-8366-4e18-aea3-4cb4a3a50b48/users&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The body of the request looks like this&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
  "identifier": "1f69e798-5852-4fdd-ab01-33bb14b6e934",
  "groupUserAccessRight": "Admin",
  "principalType": "App"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 07:14:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3640326#M48777</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-16T07:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have a Service Principal add itself as workspace Member ?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3640420#M48782</link>
      <description>&lt;P&gt;Well of course, that endpoint API adds an SP to a Workspace, but you can only call it with your own identity, or you can call it with an SP identity only if the SP you're using is already a member of the workspace.&lt;/P&gt;&lt;P&gt;That's what I wanted to communicate when I wrote :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;- Calling the regular non-admin API endpoint to perform the same ends with an error too, indicating that the workspace doesn't exist or I don't have permissions on it. Which is true since the SP is not (yet) a member of the workspace...&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your answer though&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jan 2024 08:15:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3640420#M48782</guid>
      <dc:creator>Yasston</dc:creator>
      <dc:date>2024-01-16T08:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have a Service Principal add itself as workspace Member ?</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3645362#M48832</link>
      <description>&lt;P&gt;Up ^^&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 08:31:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Is-it-possible-to-have-a-Service-Principal-add-itself-as/m-p/3645362#M48832</guid>
      <dc:creator>Yasston</dc:creator>
      <dc:date>2024-01-18T08:31:03Z</dc:date>
    </item>
  </channel>
</rss>

