Forum Discussion
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-service-principal
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
+- 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
+- var reportEmbedData = await _reportEmbedService.GetReportEmbedData();
1 Reply
- WandahlLiperNew 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