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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.