cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
h4tt3n
Resolver II
Resolver II

(PowerShell) Connect-PowerBIServiceAccount not working

Hello folks,

 

Since yesterday I have been unable to log on to PBI service through PowerShell with the 

Connect-PowerBIServiceAccount command. I have been working with PBI service management via PS scripts for some time, adding/deleting reports, refreshing datasets, managing refresh schedules an so on, and it has worked really well until now.
 
It is critical that the error is found quickly, since it is preventing me from doing my job and keeps the many PBI reports of our company hanging in an unmanaged state.
 
What could be the cause of this error? It turned up overnight and is not caused by any change in the scripts or developer environment (VS Code).
 
Here is the error mesage:
 

Sorry, but we’re having trouble signing you in.

 
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'ea0616ba-638b-4df5-95b9-636659ae5121'.

Request Id: 18389c28-151c-4286-aaf4-67606d172e00

Correlation Id: f79280b7-ad4f-4119-a7ad-5e6ef4b33032

Timestamp: 2021-02-19T11:53:23Z

Message: AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: 'ea0616ba-638b-4df5-95b9-636659ae5121'.

1 ACCEPTED SOLUTION
h4tt3n
Resolver II
Resolver II

Problem found and solved!

It turned out that an update to the PowerShell extension for VS Code set this value "powershell.useX86Host": true. In other words, it started running 32 bit as default. Manually changing it back to x64 like shown in the screenshots belov solved the problem:

h4tt3n_0-1631275565268.png

 

h4tt3n_1-1631275575535.png


Cheers, Mike

View solution in original post

18 REPLIES 18
h4tt3n
Resolver II
Resolver II

Problem found and solved!

It turned out that an update to the PowerShell extension for VS Code set this value "powershell.useX86Host": true. In other words, it started running 32 bit as default. Manually changing it back to x64 like shown in the screenshots belov solved the problem:

h4tt3n_0-1631275565268.png

 

h4tt3n_1-1631275575535.png


Cheers, Mike

h4tt3n
Resolver II
Resolver II

OP here, problem is partially solved. The script runs fine in the PowerShell ISE editor, but it won't run in VS code. If you are having problems, try updating the MicrosoftPowerBIMgmt module with the command: 

 

Install-Module MicrosoftPowerBIMgmt -force -AllowClobber

and then run the script in either PS command line tool or ISE. This has worked for me. 

However, since VS code is a superior toll over cmd or ISE, and sinc it is a Microsoft product, I am holding my support ticket open.
h4tt3n
Resolver II
Resolver II

OP here. The problem has returned again, and has persisted for about a week. No changes has been made on our side to any PS scripts. We get the exact same error message. What is the issue, and can we do anything about it?

Hi @alexgor87,

If you do not change the setting on these function usage but this issue appears frequently. It means the issues may be related to some backend/remote processing of these function usages.
In my opinion, I'd like to suggest contact to the author of the packages to report this.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Exactly my thought. We use Microsofts official PowerBi management package, so I think the best thing to do is open a ticket with their support.

I uninstalled the powershell module and reinstalled it again to update to the latest version.

 

I now receive a different error:

Login-PowerBI -Credential $credential
Login-PowerBI : One or more errors occurred.
At line:1 char:5
+ Login-PowerBI -Credential $credential
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...IServiceAccount:ConnectPowerBIServiceAccount) [Connect-PowerBIServiceAccount], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount

WARNING: (False) MSAL 4.25.0.0 MSAL.Desktop Microsoft Windows NT 10.0.19042.0 [08/26/2021 08:30:16 - a8595795-2a3c-4957-a9c1-289ad9698d27] Request retry failed.
WARNING: (False) MSAL 4.25.0.0 MSAL.Desktop Microsoft Windows NT 10.0.19042.0 [08/26/2021 08:30:16 - a8595795-2a3c-4957-a9c1-289ad9698d27] Exception type: Microsoft.Identity.Client.MsalUiRequ
iredException
, ErrorCode: invalid_grant
HTTP StatusCode 400
CorrelationId a8595795-2a3c-4957-a9c1-289ad9698d27

WARNING: (False) MSAL 4.25.0.0 MSAL.Desktop Microsoft Windows NT 10.0.19042.0 [08/26/2021 08:30:16 - a8595795-2a3c-4957-a9c1-289ad9698d27] Exception type: Microsoft.Identity.Client.MsalUiRequ
iredException
, ErrorCode: invalid_grant
HTTP StatusCode 400
CorrelationId a8595795-2a3c-4957-a9c1-289ad9698d27

at Microsoft.Identity.Client.OAuth2.OAuth2Client.ThrowServerException(HttpResponse response, RequestContext requestContext)
at Microsoft.Identity.Client.OAuth2.OAuth2Client.CreateResponse[T](HttpResponse response, RequestContext requestContext)
at Microsoft.Identity.Client.OAuth2.OAuth2Client.<ExecuteRequestAsync>d__11`1.MoveNext()

I was just about to raise the ticket, and I checked the version of the MicrosoftPowerBIMgmt  package. Mine was 1.0.896, while the latest is 1.2.1026:
https://www.powershellgallery.com/packages/MicrosoftPowerBIMgmt/1.2.1026 


So 
I updated the module and all dependent modules:
MicrosoftPowerBIMgmt.Admin (>= 1.2.1026)
MicrosoftPowerBIMgmt.Capacities (>= 1.2.1026)
MicrosoftPowerBIMgmt.Data (>= 1.2.1026)
MicrosoftPowerBIMgmt.Profile (>= 1.2.1026)
MicrosoftPowerBIMgmt.Reports (>= 1.2.1026)
MicrosoftPowerBIMgmt.Workspaces (>= 1.2.1026)

and the problem has gone! Hope this will work for you too!

Thank you for the feedback. I have tried this solution, but unfortunately it did not solve the problem. May I ask what dev tools you are using? I am using VS code with powershell 5.1 for development.

I was running the commands from the standard Windows PowerShell terminal (5.1) as administrator. I also have VS Code, but I don't use very complex scripts so there's nothing much to develop at the moment.

This is interesting: The script runs fine in the PowerShell ISE editor, but it won't run in VS code. IF you are having problems, try updating the MicrosoftPowerBIMgmt module with the command: 

 

Install-Module MicrosoftPowerBIMgmt -force -AllowClobber

and then run the script in either PS command line tool or ISE. This has worked for me. 

However, since VS code is a superior toll over cmd or ISE, and sinc it is a Microsoft product, I am holding my support ticket open.

This fixed the issue for me, thank you for sharing!

I was using Service Principal method to sign in and had the same error. I was noticed it was working fine in x86 version of PowerShell ISE however. 

The problem
Connect-PowerBIServiceAccount -ServicePrincipal -CertificateThumbprint xxxx -ApplicationId xxxx

..Kept throwing errors such as :

Login-PowerBIServiceAccount : One or more errors occurred.
At line:1 char:1
+ Login-PowerBIServiceAccount
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (Microsoft.Power...IServiceAccount:ConnectPowerBIServiceAccount) [Connect-PowerBIServiceAccount], AggregateException
    + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount

--

 

My solution was this:

1) Close all open powershell sessions. Go to C:\Program Files\WindowsPowerShell\Modules and delete all MicrosoftPowerBIMgmt modules (folders) manually

2) Open PowerShell ISE as admin , and run

 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  Unregister-PSRepository -Name PSGallery
  Register-PSRepository -Default

 

3) Make sure this command works and finds shows version of 1.2.1077 (or above)

 Find-Module MicrosoftPowerBIMgmt 

agneum_0-1658490598527.png

 

3) Install the module again

 Install-Module MicrosoftPowerBIMgmt -force -AllowClobber



The service account (app registration) needed access to the Power BI API, and I also had to enable "Allow service principals to use Power BI APIs" under tenant settings. (I used security group at first, but removed it, not sure if it's related to the issue)

 

agneum_1-1658490713547.png

agneum_2-1658490801774.png

 

 

 

alexgor87
Advocate I
Advocate I

Hi @v-shex-msft, I have this problem for a week already and it doesn't go away.
I've also checked App Registrations and there is no such app with the ID 'ea0616ba-638b-4df5-95b9-636659ae5121'. Any thoughts? Thanks

OP here, now we are experiencing the same problem again, and is has persisted for several days. 

youssefyoussef
Frequent Visitor

Hi @v-shex-msft ,

 

I am experiencing the same exact problem today. 

h4tt3n
Resolver II
Resolver II

Problem disappeared by itself after 3 days.

v-shex-msft
Community Support
Community Support

Hi @h4tt3n,

I test the Connect-PowerBIServiceAccount with OAuth mode and it works well.

What authorization mode you work on? Did this issue still appear on your side? Any policy or rule change that applies to your device/environment? (they may block power bi requests) Please share more detailed information to help us clarify these.
How to Get Your Question Answered Quickly 
Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi @v-shex-msft 

 

The problem has disappeared again over the weekend. I assume it was due to overload on parts of the Microsoft servers or a small bug that was caught and fixed quickly.

Cheers, Mike

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.