Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect-PowerBIServiceAccount : Can't connect with Certificate but works with ClientSecret #411

Open
jolscr opened this issue Sep 18, 2024 · 0 comments

Comments

@jolscr
Copy link

jolscr commented Sep 18, 2024

Hi everybody,

  1. I create an app registration (without api permission as descibed in the MS documentation).
  2. I create a security group and add the app registration as member
  3. I allow service principal to use API Fabric in the PowerBI Admin Portal for this security group.
  4. I allow service principal to access Admin API in readonly in the PowerBI Admin Portal for this security group
  5. I also allow improve answers for metadata and DAX espression in the PowerBI Admin Portal for this security group

If I connect with Credential (Client Secret) it works, but not with Certificate :

image

Here is the output trace with Resolve-PowerBIError :

Message : Error Acquiring Token:
MSAL.Desktop.4.27.0.0.MsalServiceException:
ErrorCode: unauthorized_client
Microsoft.Identity.Client.MsalServiceException: AADSTS700016: Application with identifier 'xxxxxxxxxxxxxxxxxxxxxxx' was not found in the directory 'Microsoft Services'. This can
happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong
tenant. Trace ID: xxxxxxxxxxxxxxxxxxxxxxxx Correlation ID: xxxxxxxxxxxxxxxxxxxxxxxxxx Timestamp: 2024-09-18 09:44:17Z
à Microsoft.Identity.Client.OAuth2.OAuth2Client.ThrowServerException(HttpResponse response, RequestContext requestContext)
à Microsoft.Identity.Client.OAuth2.OAuth2Client.CreateResponse[T](HttpResponse response, RequestContext requestContext)
à Microsoft.Identity.Client.OAuth2.OAuth2Client.d__11`1.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.Identity.Client.OAuth2.OAuth2Client.d__10.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.Identity.Client.OAuth2.TokenClient.d__8.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à Microsoft.Identity.Client.OAuth2.TokenClient.d__8.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.Identity.Client.OAuth2.TokenClient.d__5.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.Identity.Client.Internal.Requests.RequestBase.d__20.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.Identity.Client.Internal.Requests.ClientCredentialRequest.d__3.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.Identity.Client.Internal.Requests.ClientCredentialRequest.d__2.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.Identity.Client.Internal.Requests.RequestBase.d__13.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.Identity.Client.ApiConfig.Executors.ConfidentialClientExecutor.d__3.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.PowerBI.Common.Authentication.ServicePrincipalAuthenticationFactory.d__3.MoveNext()
StatusCode: 400
ResponseBody: {"error":"unauthorized_client","error_description":"AADSTS700016: Application with identifier 'xxxxxxxxxxxxxxxxxxxxxxxxx' was not found in the directory 'Microsoft
Services'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication
request to the wrong tenant. Trace ID: xxxxxxxxxxxxxxxxxxx Correlation ID: xxxxxxxxxxxxxxxxxxxxxx Timestamp: 2024-09-18
09:44:17Z","error_codes":[700016],"timestamp":"2024-09-18
09:44:17Z","trace_id":"xxxxxxxxxxxxxxxxxxxxxx","correlation_id":"xxxxxxxxxxxxxxxxxxxx","error_uri":"https://login.microsoftonline.com/error?code=700016"}
Headers: Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
client-request-id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x-ms-request-id: xxxxxxxxxxxxxxxxxxxxxxx
x-ms-ests-server: 2.1.18947.4 - WEULR1 ProdSlices
x-ms-clitelem: 1,700016,0,,
x-ms-srs: 1.P
X-XSS-Protection: 0
Cache-Control: no-store, no-cache
P3P: CP="DSP CUR OTPi IND OTRi ONL FIN"
Set-Cookie: fpc=xxxxxxxxxxxxxxxxxxx; expires=Fri, 18-Oct-2024 09:44:17 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd; path=/; secure;
httponly
Date: Wed, 18 Sep 2024 09:44:17 GMT

StackTrace : à Microsoft.PowerBI.Common.Authentication.ServicePrincipalAuthenticationFactory.d__3.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à Microsoft.PowerBI.Commands.Common.AuthenticationFactorySelector.d__10.MoveNext()
Exception : System.Security.Authentication.AuthenticationException
InvocationInfo : {Connect-PowerBIServiceAccount}
Line : Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint $certificateThumbprint -ApplicationId $clientId
Position : Au caractère Ligne:1 : 1
+ Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprin ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant