Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
OutdoorEd
Frequent Visitor

Service Principal with Embedded 'BadRequest' on connecting to Azure SQL

I have a PowerBI Embedded ASP.NET Core App running locally. I have gone through all of the setup to use a Service Principal based on https://docs.microsoft.com/en-us/power-bi/developer/embed-service-principal#get-started-with-a-servi...

 

I uploaded  on of the MS Sample Business PBIX it my Workspace and set the correct Service Principal as Admin. Running my Embed Page locally it runs fine. That means all of the authentication and tokens are working prooerly. However, when I try and use one of my PBIX files that connects to my Azure SQL Database, it fails with BadRequest. This PBIX works fine in my PowerBI.com account so I know that there isn't anything wrong with that. I can't figure out what is wrong with my setup.

 

HttpOperationException: Operation returned an invalid status code 'BadRequest'

  • Microsoft.PowerBI.Api.V2.Reports.GenerateTokenInGroupWithHttpMessagesAsync(string groupId, string reportKey, GenerateTokenRequest requestParameters, Dictionary<string, List<string>> customHeaders, CancellationToken cancellationToken)

  • Microsoft.PowerBI.Api.V2.ReportsExtensions.GenerateTokenInGroupAsync(IReports operations, string groupId, string reportKey, GenerateTokenRequest requestParameters, CancellationToken cancellationToken)

  • OE_Tenant.Analytics.ReportEmbedService.GetReportEmbedData() in ReportEmbedService.cs

    +
    1. string embedToken =
  • Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult<T>(Task<T> actualReturnValue, Func<Task> postAction, Action<Exception> finalAction)

  • Abp.Threading.InternalAsyncHelper.AwaitTaskWithFinallyAndGetResult<T>(Task<T> actualReturnValue, Action<Exception, Task> finalAction)

  • OE_Tenant.Web.Areas.Incidents.Controllers.AnalyticsController.Index() in AnalyticsController.cs

    +
    1. var reportEmbedData = await _reportEmbedService.GetReportEmbedData();
1 REPLY 1
WandahlLiper
New Member

I have the exact same problem. I followed the guidelines in this video: https://www.youtube.com/watch?v=ZhMfpdXLIw0 using the app found here: https://github.com/CriticalPathTraining/AppOnlyAuth

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.