<?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: Trouble Getting Power BI Embedded A1 Capacity ID in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Trouble-Getting-Power-BI-Embedded-A1-Capacity-ID/m-p/2825284#M39119</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/451991"&gt;@Log4TurtleShell&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you can open a support ticket to get more help, it's free.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://powerbi.microsoft.com/en-us/support/" target="_blank"&gt;https://powerbi.microsoft.com/en-us/support/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;</description>
    <pubDate>Fri, 07 Oct 2022 09:31:01 GMT</pubDate>
    <dc:creator>v-chenwuz-msft</dc:creator>
    <dc:date>2022-10-07T09:31:01Z</dc:date>
    <item>
      <title>Trouble Getting Power BI Embedded A1 Capacity ID</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Trouble-Getting-Power-BI-Embedded-A1-Capacity-ID/m-p/2820377#M39084</link>
      <description>&lt;P class="lia-align-left"&gt;Okay here we go. I hope this will help others trying who are trying to use Power BI Embedded (A skus) with Service Principal authentication to Embed for your Customers.&amp;nbsp;Here are the steps I took to get to my problem, but the problem is in bold at the bottom if you want to skip ahead.&amp;nbsp;If anyone can help me I will buy them a coffee. Seriously.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been struggling to get Power BI Embedded set up, starting with an A1 sku. My setup is to embed for customers using a service principal. The main resource I am using for the initial setup is &lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-customers?tabs=net-core" target="_self"&gt;https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-customers?tabs=net-core&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have finished every step at the link above using a service principal. After downloading the sample project in step 8, I am able to run the .NET core app with my service principal and see the sample report in my Power BI workspace. I also modified the sample report to make sure it is working correctly. That is rad, but displayed above the report is the "This is a free trial version, to remove this label a capacity must be purchased." No problem, let's check docs for the next step, &lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/move-to-production" target="_blank" rel="noopener"&gt;Moving to Production&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Okay I need to assign my workspace to a capacity. Since I am using a Service Principal I need to use the Power BI Rest API, specifically this endpoint &lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/capacities/groups-assign-to-capacity" target="_blank" rel="noopener"&gt;AssignToCapacity&lt;/A&gt;. For that I need my WorkspaceId and CapacityId. I found the WorkspaceId by opening app.powerbi.com to my workspace, and checking the URL for the guid. Alternatively I could have used the&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/groups/get-groups" target="_blank" rel="noopener"&gt;Groups API&lt;/A&gt;.&amp;nbsp; Unfortunately that API link does not mention the authentication needed. To authenticate to that API you need to pass a Bearer token in the header. To get the token, make a GET request to&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://login.microsoftonline.com/{{your_tenantId_here}}/oauth2/v2.0/token/" target="_blank" rel="noopener"&gt;https://login.microsoftonline.com/{{your_tenantId_here}}/oauth2/v2.0/token/&lt;/A&gt;. For the content type use "application/x-www-form-urlencoded". In the body make sure to pass:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;grant_type = client_credentials&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;scope&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi%2F.default&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;client_id&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;{{your_servicePrinicpal_clientId_here}}&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;client_secret&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;{{your_servicePrinicpal_clientSecret_here}}&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;Now for the CapacityId, I opened my Power BI Embedded A1 resource in the Azure portal. Okay it's not in the Overview, so I will check Properties. Nope, not there either. After some sleuthing I found that the only way to get the CapacityId is by calling this&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi/capacities/get-capacities" target="_self"&gt;API&lt;/A&gt;&lt;SPAN&gt;. I know how to get the auth token, so I grab that and call the API. &lt;STRONG&gt;Here is my actual current problem: When the&amp;nbsp;Get Capacities response is returned there is only one value, and it is a "Premium Per User - Reserved" capacity with a sku of "PP3". My A1 sku is nowhere to be found. I followed all the steps, and all the permissions *should* be setup correctly. The capacity is not paused, and the status is active. The resource mode is Generation 2.&amp;nbsp;&lt;SPAN&gt;Does anyone know common reasons why my A1 sku is not being returned when calling this API?&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;STRONG&gt;EDIT: I think the issue may be that I am calling the wrong API to get the CapacityId. I am calling the Power BI API, and since my Power BI workspace has not been connected to the capacity yet that is probably why it is not returned. I think I need to call the Azure Management API, specifically&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/get-details" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/rest/api/power-bi-embedded/capacities/get-details&lt;/A&gt;. I think a V1 AAD token is needed for this call. I got the token, but I can't get the call to work. It seems it does not like my chosen scope. Error message:&amp;nbsp;&lt;EM&gt;The access token has been obtained for wrong audience or resource. It should exactly match with one of the allowed audiences '&lt;A title="https://management.core.windows.net/','https://management.core.windows.net','https://management.azure.com/','https://management.azure.com'." href="https://management.core.windows.net/','https://management.core.windows.net','https://management.azure.com/','https://management.azure.com'." target="_blank" rel="noopener noreferrer"&gt;https://management.core.windows.net/','https://management.core.windows.net','https://management.azure.com/','https://management.azure.com'.&lt;/A&gt;"&lt;/EM&gt;.&amp;nbsp;https%3A%2F%2Fmanagement.azure.com and&amp;nbsp;https%3A%2F%2Fmanagement.azure.com%2F are not working. I will try the others when I get a chance.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;EDIT2: I managed to get a proper V1 AAD token using the following request body params. Note that I needed to change scope from the V2 call to resource.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;STRONG&gt;grant_type=client_credentials&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;resource&lt;/STRONG&gt;=&lt;A href="https://management.azure.com/" target="_blank"&gt;https://management.azure.com/&lt;/A&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;client_id={{&lt;SPAN&gt;your_servicePrinicpal_clientId_here&lt;/SPAN&gt;}}&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;client_secret={{&lt;SPAN&gt;your_servicePrinicpal_clientSecret_here&lt;/SPAN&gt;}}&lt;BR /&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Now I am running into a permission error with the Capacity API call.&amp;nbsp;&lt;SPAN&gt;"The client '{guid}' with object id '{guid}' does not have authorization to perform action 'Microsoft.PowerBIDedicated/capacities/read' over scope '/subscriptions/{guid}/resourceGroups/{resourceName}/providers/Microsoft.PowerBIDedicated/capacities/{capacityName}' or the scope is invalid. If access was recently granted, please refresh your credentials." Now to figure out how to set the required permission...&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;My next steps (In case anyone has any hints or tips):&lt;/SPAN&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;After I manage to get the CapacityId I will make the API call to AssignToCapacity, and hope it works. The next time I run the sample app, the "free trial version" banner should be gone.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Then I need to install an &lt;A href="https://learn.microsoft.com/en-us/power-bi/connect-data/service-gateway-onprem" target="_blank" rel="noopener"&gt;On-Premises&lt;/A&gt; gateway because we will be using data from our internal network.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;After the gateway is installed an configured, I will publish a report/dashboard and a dataset that uses our OnPrem data.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Then I will test to make sure the published report is working with the gateway.&lt;/SPAN&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;SubStep: I will follow the instructions at&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/embedded/embedded-capacity-planning" target="_blank" rel="noopener"&gt;https://learn.microsoft.com/en-us/power-bi/developer/embedded/embedded-capacity-planning&lt;/A&gt;&amp;nbsp;to try and load test my published report to see if A1 capacity will be enough for my purposes.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Then I will finally be able to use the Power BI SDK to generate EmbedTokens and EmbedUrls server side, and then send them to my client.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Rants and Raves (Not important, but maybe someone will commiserate with me):&lt;/SPAN&gt;&lt;/DIV&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;The documentation for Power BI Embedded is incomplete and spread out all over the place. I learned almost as much from scouring these forums as I have from the documentation. Thank you forum members, moderators, and the like.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Apparently workspaces are groups and groups are workspaces. Not confusing at all Microsoft.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Why is the CapacityId not listed on my Power BI Embedded A1 resource in the Azure portal? Security reasons?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;The Power BI API link is mildly infuriating: &lt;A href="https://api.powerbi.com/v1.0/myorg/capacities" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/capacities&lt;/A&gt;. Did anyone else spend 30 minutes trying to figure out what to replace the "myorg" segment with? Hint: you don't. It's quite possible I am just dense.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;For a service that costs at minimum over $700 a month, assuming the capacity is not being paused, the setup should not be this difficult.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 05 Oct 2022 18:00:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Trouble-Getting-Power-BI-Embedded-A1-Capacity-ID/m-p/2820377#M39084</guid>
      <dc:creator>Log4TurtleShell</dc:creator>
      <dc:date>2022-10-05T18:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Getting Power BI Embedded A1 Capacity ID</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Trouble-Getting-Power-BI-Embedded-A1-Capacity-ID/m-p/2825284#M39119</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/451991"&gt;@Log4TurtleShell&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you can open a support ticket to get more help, it's free.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://powerbi.microsoft.com/en-us/support/" target="_blank"&gt;https://powerbi.microsoft.com/en-us/support/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ chenwu zhu&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2022 09:31:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Trouble-Getting-Power-BI-Embedded-A1-Capacity-ID/m-p/2825284#M39119</guid>
      <dc:creator>v-chenwuz-msft</dc:creator>
      <dc:date>2022-10-07T09:31:01Z</dc:date>
    </item>
  </channel>
</rss>

