Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I would like to execute some basic commands using PowerBi cmdlets for Powershell. I have installed these modules on PowerShell:
MicrosoftPowerBIMgmt
MicrosoftPowerBIMgmt.Admin
MicrosoftPowerBIMgmt.Capacities
MicrosoftPowerBIMgmt.Data
MicrosoftPowerBIMgmt.Profile
MicrosoftPowerBIMgmt.Reports
MicrosoftPowerBIMgmt.Workspaces
When using "Connect-PowerBIServiceAccount" the login screen for my organization comes up and I login correctly using my credentials.
Once the connection is established i need to execute these simple calls: "Get-PowerBIWorkspace" and "Get-PowerBIReport" but I get this error:
Message : Error Acquiring Token:
The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing methods, and
they can only be called from within the same thread. Validate that the cmdlet makes these calls correctly, or contact Microsoft Customer Support Services.
StackTrace : in Microsoft.PowerBI.Common.Authentication.WindowsAuthenticationFactory.<HandleAuthentication>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in Microsoft.PowerBI.Common.Authentication.WindowsAuthenticationFactory.<Authenticate>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in Microsoft.PowerBI.Commands.Common.AuthenticationFactorySelector.<Authenticate>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in Microsoft.PowerBI.Commands.Common.AuthenticationFactorySelector.<Authenticate>d__7.MoveNext()
Exception : System.Security.Authentication.AuthenticationException
InvocationInfo : {Get-PowerBIWorkspace}
Line : Get-PowerBIWorkspace
Position : line:1 char:1
+ Get-PowerBIWorkspace
+ ~~~~~~~~~~~~~~~~~~~~
HistoryId : 7
I have full permissions in Azure Active Directory and PowerBi Service Account. Please any ideas how to solve this issue?
Thank you
Hi @Andrea_CS ,
Please check your environments and PowerShell versions.
For reference: Microsoft Power BI Cmdlets for Windows PowerShell and PowerShell Core
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
8 | |
7 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 |