<?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 Embedding Report in Web Application, Authentication Error in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2333591#M34344</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am struggling to embed a power bi report into a web application.&lt;/P&gt;&lt;P&gt;I created an Azure App and granted the Power BI Service authentication but still receiving error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the error that appears in developer tools in the web browser: and then the steps i took:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;blazor.server.js:19&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;[2022-02-11T13:49:10.049Z] Error: Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'Unauthorized'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;at Microsoft.PowerBI.Api.ReportsOperations.GetReportInGroupWithHttpMessagesAsync(Guid groupId, Guid reportId, Dictionary`2 customHeaders, CancellationToken cancellationToken)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;at Microsoft.PowerBI.Api.ReportsOperationsExtensions.GetReportInGroupAsync(IReportsOperations operations, Guid groupId, Guid reportId, CancellationToken cancellationToken)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;at BlazorPowerBIEmbed.Pages.Index.OnAfterRenderAsync(Boolean firstRender) in C:\Users\ic\Desktop\Sandbox\BlazorPowerBIEmbed\BlazorPowerBIEmbed\Pages\Index.razor:line 55&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Simple, Blazor Service Side App&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;_Host.cshtml&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;script src="js/powerbi.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;window.ShowMyPowerBI = {&lt;BR /&gt;showReport: function (reportContainer, accessToken, embedUrl, embedReportId) {&lt;BR /&gt;// Get models. models contains enums that can be used.&lt;BR /&gt;var models = window['powerbi-client'].models;&lt;BR /&gt;var config = {&lt;BR /&gt;type: 'report',&lt;BR /&gt;tokenType: models.TokenType.Embed,&lt;BR /&gt;accessToken: accessToken,&lt;BR /&gt;embedUrl: embedUrl,&lt;BR /&gt;id: embedReportId,&lt;BR /&gt;permissions: models.Permissions.All,&lt;BR /&gt;settings: {&lt;BR /&gt;filterPaneEnabled: true,&lt;BR /&gt;navContentPaneEnabled: true&lt;BR /&gt;}&lt;BR /&gt;};&lt;BR /&gt;// Embed the report and display it within the div container.&lt;BR /&gt;powerbi.embed(reportContainer, config);&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;PowerBI.razor&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@page "/PowerBI"&lt;BR /&gt;@using System.Net.Http&lt;BR /&gt;@using System.Threading.Tasks&lt;BR /&gt;@using Microsoft.Identity.Client&lt;BR /&gt;@using Microsoft.PowerBI.Api&lt;BR /&gt;@using Microsoft.PowerBI.Api.Models&lt;BR /&gt;@using Microsoft.Rest&lt;BR /&gt;@using Newtonsoft.Json.Linq&lt;BR /&gt;@using Microsoft.Extensions.Configuration&lt;BR /&gt;@using Microsoft.JSInterop&lt;/P&gt;&lt;P&gt;@inject IJSRuntime JSRuntime&lt;BR /&gt;@inject IConfiguration _configuration&lt;/P&gt;&lt;P&gt;&amp;lt;h3&amp;gt;PowerBI Embedded&amp;lt;/h3&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div @ref="@PowerBIElement" style="width:100%;height:600px;max-width: 2000px" /&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/71451"&gt;@code&lt;/a&gt; {&lt;BR /&gt;private ElementReference PowerBIElement;&lt;BR /&gt;string TenantID = "asdf";&lt;BR /&gt;string ClientID = "asdf";&lt;BR /&gt;&lt;BR /&gt;string ClientSecret = "asdf";&lt;BR /&gt;string workspaceId = "asdf";&lt;BR /&gt;string reportId = "asdf";&lt;BR /&gt;protected override async Task&lt;BR /&gt;OnAfterRenderAsync(bool firstRender)&lt;BR /&gt;{&lt;BR /&gt;if (firstRender)&lt;BR /&gt;{&lt;BR /&gt;var result = new PowerBIEmbedConfig();&lt;BR /&gt;// Authenticate using created credentials&lt;/P&gt;&lt;P&gt;AuthenticationResult authenticationResult = null;&lt;BR /&gt;authenticationResult = await DoAuthentication();&lt;BR /&gt;var tokenCredentials =&lt;BR /&gt;new TokenCredentials(authenticationResult.AccessToken, "Bearer");&lt;BR /&gt;using (var client = new PowerBIClient(&lt;BR /&gt;new Uri("&lt;A href="https://api.powerbi.com/" target="_blank" rel="noopener"&gt;https://api.powerbi.com/&lt;/A&gt;"), tokenCredentials))&lt;BR /&gt;{&lt;BR /&gt;var report =&lt;BR /&gt;await client.Reports.GetReportInGroupAsync(&lt;BR /&gt;new Guid(workspaceId),&lt;BR /&gt;new Guid(reportId));&lt;BR /&gt;var generateTokenRequestParameters =&lt;BR /&gt;new GenerateTokenRequest(accessLevel: "view");&lt;BR /&gt;var tokenResponse =&lt;BR /&gt;await client.Reports.GenerateTokenAsync(&lt;BR /&gt;new Guid(workspaceId),&lt;BR /&gt;new Guid(reportId),&lt;BR /&gt;generateTokenRequestParameters);&lt;BR /&gt;result.EmbedToken = tokenResponse;&lt;BR /&gt;result.EmbedUrl = report.EmbedUrl;&lt;BR /&gt;result.Id = report.Id.ToString();&lt;BR /&gt;await Interop.CreateReport(&lt;BR /&gt;JSRuntime,&lt;BR /&gt;PowerBIElement,&lt;BR /&gt;tokenResponse.Token,&lt;BR /&gt;report.EmbedUrl,&lt;BR /&gt;report.Id.ToString());&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;private const string AuthorityFormat = "&lt;A href="https://login.microsoftonline.com/{0}/v2.0" target="_blank" rel="noopener"&gt;https://login.microsoftonline.com/{0}/v2.0&lt;/A&gt;";&lt;BR /&gt;private const string MSGraphScope = "&lt;A href="https://analysis.windows.net/powerbi/api/.default" target="_blank" rel="noopener"&gt;https://analysis.windows.net/powerbi/api/.default&lt;/A&gt;";&lt;BR /&gt;private async Task&amp;lt;AuthenticationResult&amp;gt;&lt;BR /&gt;DoAuthentication()&lt;BR /&gt;{&lt;BR /&gt;IConfidentialClientApplication daemonClient;&lt;BR /&gt;daemonClient = ConfidentialClientApplicationBuilder.Create(ClientID)&lt;BR /&gt;.WithAuthority(string.Format(AuthorityFormat, TenantID))&lt;BR /&gt;.WithClientSecret(ClientSecret)&lt;BR /&gt;.Build();&lt;BR /&gt;AuthenticationResult authResult =&lt;BR /&gt;await daemonClient.AcquireTokenForClient(new[] { MSGraphScope }).ExecuteAsync();&lt;BR /&gt;return authResult;&lt;BR /&gt;}&lt;BR /&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Feb 2022 14:01:02 GMT</pubDate>
    <dc:creator>ian_coetzer</dc:creator>
    <dc:date>2022-02-11T14:01:02Z</dc:date>
    <item>
      <title>Embedding Report in Web Application, Authentication Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2333591#M34344</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I am struggling to embed a power bi report into a web application.&lt;/P&gt;&lt;P&gt;I created an Azure App and granted the Power BI Service authentication but still receiving error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the error that appears in developer tools in the web browser: and then the steps i took:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;blazor.server.js:19&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;[2022-02-11T13:49:10.049Z] Error: Microsoft.Rest.HttpOperationException: Operation returned an invalid status code 'Unauthorized'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;at Microsoft.PowerBI.Api.ReportsOperations.GetReportInGroupWithHttpMessagesAsync(Guid groupId, Guid reportId, Dictionary`2 customHeaders, CancellationToken cancellationToken)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;at Microsoft.PowerBI.Api.ReportsOperationsExtensions.GetReportInGroupAsync(IReportsOperations operations, Guid groupId, Guid reportId, CancellationToken cancellationToken)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;at BlazorPowerBIEmbed.Pages.Index.OnAfterRenderAsync(Boolean firstRender) in C:\Users\ic\Desktop\Sandbox\BlazorPowerBIEmbed\BlazorPowerBIEmbed\Pages\Index.razor:line 55&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Simple, Blazor Service Side App&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;_Host.cshtml&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;script src="js/powerbi.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;window.ShowMyPowerBI = {&lt;BR /&gt;showReport: function (reportContainer, accessToken, embedUrl, embedReportId) {&lt;BR /&gt;// Get models. models contains enums that can be used.&lt;BR /&gt;var models = window['powerbi-client'].models;&lt;BR /&gt;var config = {&lt;BR /&gt;type: 'report',&lt;BR /&gt;tokenType: models.TokenType.Embed,&lt;BR /&gt;accessToken: accessToken,&lt;BR /&gt;embedUrl: embedUrl,&lt;BR /&gt;id: embedReportId,&lt;BR /&gt;permissions: models.Permissions.All,&lt;BR /&gt;settings: {&lt;BR /&gt;filterPaneEnabled: true,&lt;BR /&gt;navContentPaneEnabled: true&lt;BR /&gt;}&lt;BR /&gt;};&lt;BR /&gt;// Embed the report and display it within the div container.&lt;BR /&gt;powerbi.embed(reportContainer, config);&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;PowerBI.razor&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@page "/PowerBI"&lt;BR /&gt;@using System.Net.Http&lt;BR /&gt;@using System.Threading.Tasks&lt;BR /&gt;@using Microsoft.Identity.Client&lt;BR /&gt;@using Microsoft.PowerBI.Api&lt;BR /&gt;@using Microsoft.PowerBI.Api.Models&lt;BR /&gt;@using Microsoft.Rest&lt;BR /&gt;@using Newtonsoft.Json.Linq&lt;BR /&gt;@using Microsoft.Extensions.Configuration&lt;BR /&gt;@using Microsoft.JSInterop&lt;/P&gt;&lt;P&gt;@inject IJSRuntime JSRuntime&lt;BR /&gt;@inject IConfiguration _configuration&lt;/P&gt;&lt;P&gt;&amp;lt;h3&amp;gt;PowerBI Embedded&amp;lt;/h3&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div @ref="@PowerBIElement" style="width:100%;height:600px;max-width: 2000px" /&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/71451"&gt;@code&lt;/a&gt; {&lt;BR /&gt;private ElementReference PowerBIElement;&lt;BR /&gt;string TenantID = "asdf";&lt;BR /&gt;string ClientID = "asdf";&lt;BR /&gt;&lt;BR /&gt;string ClientSecret = "asdf";&lt;BR /&gt;string workspaceId = "asdf";&lt;BR /&gt;string reportId = "asdf";&lt;BR /&gt;protected override async Task&lt;BR /&gt;OnAfterRenderAsync(bool firstRender)&lt;BR /&gt;{&lt;BR /&gt;if (firstRender)&lt;BR /&gt;{&lt;BR /&gt;var result = new PowerBIEmbedConfig();&lt;BR /&gt;// Authenticate using created credentials&lt;/P&gt;&lt;P&gt;AuthenticationResult authenticationResult = null;&lt;BR /&gt;authenticationResult = await DoAuthentication();&lt;BR /&gt;var tokenCredentials =&lt;BR /&gt;new TokenCredentials(authenticationResult.AccessToken, "Bearer");&lt;BR /&gt;using (var client = new PowerBIClient(&lt;BR /&gt;new Uri("&lt;A href="https://api.powerbi.com/" target="_blank" rel="noopener"&gt;https://api.powerbi.com/&lt;/A&gt;"), tokenCredentials))&lt;BR /&gt;{&lt;BR /&gt;var report =&lt;BR /&gt;await client.Reports.GetReportInGroupAsync(&lt;BR /&gt;new Guid(workspaceId),&lt;BR /&gt;new Guid(reportId));&lt;BR /&gt;var generateTokenRequestParameters =&lt;BR /&gt;new GenerateTokenRequest(accessLevel: "view");&lt;BR /&gt;var tokenResponse =&lt;BR /&gt;await client.Reports.GenerateTokenAsync(&lt;BR /&gt;new Guid(workspaceId),&lt;BR /&gt;new Guid(reportId),&lt;BR /&gt;generateTokenRequestParameters);&lt;BR /&gt;result.EmbedToken = tokenResponse;&lt;BR /&gt;result.EmbedUrl = report.EmbedUrl;&lt;BR /&gt;result.Id = report.Id.ToString();&lt;BR /&gt;await Interop.CreateReport(&lt;BR /&gt;JSRuntime,&lt;BR /&gt;PowerBIElement,&lt;BR /&gt;tokenResponse.Token,&lt;BR /&gt;report.EmbedUrl,&lt;BR /&gt;report.Id.ToString());&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;private const string AuthorityFormat = "&lt;A href="https://login.microsoftonline.com/{0}/v2.0" target="_blank" rel="noopener"&gt;https://login.microsoftonline.com/{0}/v2.0&lt;/A&gt;";&lt;BR /&gt;private const string MSGraphScope = "&lt;A href="https://analysis.windows.net/powerbi/api/.default" target="_blank" rel="noopener"&gt;https://analysis.windows.net/powerbi/api/.default&lt;/A&gt;";&lt;BR /&gt;private async Task&amp;lt;AuthenticationResult&amp;gt;&lt;BR /&gt;DoAuthentication()&lt;BR /&gt;{&lt;BR /&gt;IConfidentialClientApplication daemonClient;&lt;BR /&gt;daemonClient = ConfidentialClientApplicationBuilder.Create(ClientID)&lt;BR /&gt;.WithAuthority(string.Format(AuthorityFormat, TenantID))&lt;BR /&gt;.WithClientSecret(ClientSecret)&lt;BR /&gt;.Build();&lt;BR /&gt;AuthenticationResult authResult =&lt;BR /&gt;await daemonClient.AcquireTokenForClient(new[] { MSGraphScope }).ExecuteAsync();&lt;BR /&gt;return authResult;&lt;BR /&gt;}&lt;BR /&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 14:01:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2333591#M34344</guid>
      <dc:creator>ian_coetzer</dc:creator>
      <dc:date>2022-02-11T14:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Embedding Report in Web Application, Authentication Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2336582#M34384</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/286230"&gt;@ian_coetzer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Based on the error message, it appears to be a permissions issue. Are you using &lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-customers?tabs=net-core" target="_self"&gt;&lt;STRONG&gt;embedded for customer&lt;/STRONG&gt;&lt;/A&gt; solution? There are two threads here with the same problem as yours, you can refer to the solution there to solve your problem. Hope they can help you.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/63837108/unauthorized-response-on-getreportingroupasync-powerbi-embedded-api-call-using-s" target="_self"&gt;Unauthorized response on GetReportInGroupAsync PowerBI Embedded API call using Service Principal&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;For Service Principal to work for any embedding, you need to enable Service Principal option in Power BI Admin portal and then, add it to the Power BI workspace.&lt;/P&gt;
&lt;P&gt;Please check the following once:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Check if service principal is enabled under Admin portal in Power BI service. Follow&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal#step-3---enable-the-power-bi-service-admin-settings" rel="noreferrer" target="_blank"&gt;step 3&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;onwards&lt;/LI&gt;
&lt;LI&gt;If things don't work for you after following the above step, try embedding with the developer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/.NET%20Core/Embed%20for%20your%20customers" rel="noreferrer" target="_blank"&gt;sample&lt;/A&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Besides, based on your code it looks like you are using ADAL library for authentication. Microsoft&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-migration#:%7E:text=We%20now%20recommend%20using%20the,Azure%20AD%20identities" rel="noreferrer" target="_blank"&gt;recommends to use MSAL library&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for authentication with Azure AD entities.&lt;BR /&gt;Also, you can use certificate instead of app secret for service principal authentication. (&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal-certificate" rel="noreferrer" target="_blank"&gt;Docs&lt;/A&gt;)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/53819540/status-unauthorized-401-error-while-getting-the-reports-from-the-workspace" target="_self"&gt;Status: Unauthorized (401) error while getting the reports from the workspace&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I had exact the same issue, and I checked the API call's header X-PowerBI-Error-Info. What I found there was: ServicePrincipalIsNotAllowedByTenantAdminSwitch.&lt;/P&gt;
&lt;P&gt;So, your's tenant's admin should switch on "&lt;A href="https://docs.microsoft.com/en-us/power-bi/admin/service-admin-portal#allow-service-principals-to-use-power-bi-apis" target="_self"&gt;&lt;STRONG&gt;Allow service principals to use Power BI APIs&lt;/STRONG&gt;&lt;/A&gt;" and apply it to security group where Service Principal resides:&lt;/P&gt;
&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yingyinr_0-1644832599826.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/669393iC5946497768734A9/image-size/large?v=v2&amp;amp;px=999" role="button" title="yingyinr_0-1644832599826.png" alt="yingyinr_0-1644832599826.png" /&gt;&lt;/span&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 09:59:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2336582#M34384</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-14T09:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Embedding Report in Web Application, Authentication Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2336628#M34386</link>
      <description>&lt;P&gt;Hi, I managed to get it working by including the Azure App ID that I registred as a Member in the actual Power BI workspace.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 10:13:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2336628#M34386</guid>
      <dc:creator>ian_coetzer</dc:creator>
      <dc:date>2022-02-14T10:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Embedding Report in Web Application, Authentication Error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2338906#M34406</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/286230"&gt;@ian_coetzer&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;It's glad to hear that you got it worked. And thanks for sharing your solution here. Could you please just mark your post as &lt;STRONG&gt;Answered&lt;/STRONG&gt;? It will help the others in the community find the solution easily if they face the same problem with you.&amp;nbsp;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Tue, 15 Feb 2022 08:01:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Embedding-Report-in-Web-Application-Authentication-Error/m-p/2338906#M34406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-02-15T08:01:21Z</dc:date>
    </item>
  </channel>
</rss>

