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
philipplenz1
Frequent Visitor

Service Principal

Hi!

I’ve created a Power BI Embedded APP via the Onboarding Tool (https://app.powerbi.com/embedsetup(. The App works good with the Master User Configuration. Now I want to switch to a Service Principal.

I think I have done everything according to this page – I’ve also double checked this …

https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal

 

But I receive this error message when I run the App – any ideas?

 

Serverfehler in der Anwendung /.

Response status code does not indicate success: 401 (Unauthorized).

Beschreibung: Unbehandelte Ausnahme beim Ausführen der aktuellen Webanforderung. Überprüfen Sie die Stapelüberwachung, um weitere Informationen über diesen Fehler anzuzeigen und festzustellen, wo der Fehler im Code verursacht wurde.

Ausnahmedetails: Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException: Response status code does not indicate success: 401 (Unauthorized).

Quellfehler:

 

Zeile 339:                // Authentication using app credentials

Zeile 340:                var credential = new ClientCredential(ApplicationId, ApplicationSecret);

Zeile 341:                authenticationResult = await authenticationContext.AcquireTokenAsync(ResourceUrl, credential);

Zeile 342:            }

Zeile 343:


Quelldatei: C:\Users\phili\OneDrive\Vorträge\Embedded\Playground\App Owns Data\PowerBIEmbedded_AppOwnsData\Services\EmbedService.cs    Zeile: 341

Stapelüberwachung:

 

[AdalServiceException: Response status code does not indicate success: 401 (Unauthorized).]

   Microsoft.Identity.Core.OAuth2.<GetResponseAsync>d__18`1.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Core\OAuth2\OAuthClient.cs:66

 

[AdalServiceException: AADSTS7000215: Invalid client secret is provided.

Trace ID: a53e9d3d-8355-4cac-ae8d-8977e2681801

Correlation ID: e365131b-f75c-48f9-9aba-4ff76ef849f0

Timestamp: 2020-11-28 08:59:23Z]

   Microsoft.Identity.Core.OAuth2.<GetResponseAsync>d__18`1.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Core\OAuth2\OAuthClient.cs:116

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   Microsoft.Identity.Core.OAuth2.<GetResponseAsync>d__17`1.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Core\OAuth2\OAuthClient.cs:0

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Flows.<SendHttpMessageAsync>d__75.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Flows\AcquireTokenHandlerBase.cs:405

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Flows.<SendTokenRequestAsync>d__72.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Flows\AcquireTokenHandlerBase.cs:333

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Flows.<CheckAndAcquireTokenUsingBrokerAsync>d__62.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Flows\AcquireTokenHandlerBase.cs:266

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +26

   Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Flows.<RunAsync>d__60.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\Internal\Flows\AcquireTokenHandlerBase.cs:241

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   Microsoft.IdentityModel.Clients.ActiveDirectory.<AcquireTokenForClientCommonAsync>d__37.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\AuthenticationContext.cs:508

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   Microsoft.IdentityModel.Clients.ActiveDirectory.<AcquireTokenAsync>d__64.MoveNext() in D:\a\1\s\src\Microsoft.IdentityModel.Clients.ActiveDirectory\AuthenticationContext.cs:1014

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +29

   PowerBIEmbedded_AppOwnsData.Services.<DoAuthentication>d__24.MoveNext() in C:\Users\phili\OneDrive\Vorträge\Embedded\Playground\App Owns Data\PowerBIEmbedded_AppOwnsData\Services\EmbedService.cs:341

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +29

   PowerBIEmbedded_AppOwnsData.Services.<GetTokenCredentials>d__25.MoveNext() in C:\Users\phili\OneDrive\Vorträge\Embedded\Playground\App Owns Data\PowerBIEmbedded_AppOwnsData\Services\EmbedService.cs:361

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +29

   PowerBIEmbedded_AppOwnsData.Services.<EmbedReport>d__20.MoveNext() in C:\Users\phili\OneDrive\Vorträge\Embedded\Playground\App Owns Data\PowerBIEmbedded_AppOwnsData\Services\EmbedService.cs:58

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +29

   PowerBIEmbedded_AppOwnsData.Controllers.<EmbedReport>d__3.MoveNext() in C:\Users\phili\OneDrive\Vorträge\Embedded\Playground\App Owns Data\PowerBIEmbedded_AppOwnsData\Controllers\HomeController.cs:39

   System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +102

   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +64

   System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +97

   System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +17

   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10

   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49

   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32

   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50

   System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +228

   System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10

   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10

   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49

   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34

   System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26

   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100

   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10

   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49

   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27

   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13

   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29

   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49

   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36

   System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12

   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22

   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49

   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26

   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10

   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21

   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29

   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49

   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28

   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9

   System.Web.CallHandlerExecutionStep.InvokeEndHandler(IAsyncResult ar) +152

   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +126

 

Versionsinformationen: Microsoft .NET Framework-Version:4.0.30319; ASP.NET-Version:4.8.4250.0

 

Best

Philipp

1 ACCEPTED SOLUTION
philipplenz1
Frequent Visitor

it's solved, copy & paste is hard 😞

View solution in original post

2 REPLIES 2
saadashraf
Helper I
Helper I

How did you resolve this problem ?

I am having the same problem while moving my App from MasterUser to ServicePrincipal. 

philipplenz1
Frequent Visitor

it's solved, copy & paste is hard 😞

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.

Top Solution Authors
Top Kudoed Authors