Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
chotu27
Post Patron
Post Patron

Unable to call Workspace in Service using Power shell commands

Hi All,

 

I am able to connect to Power bi service from powershell using command connect-PowerBIServiceAccount. But when try to call the workspaces using  Get_PowerBIworkspace i am getting below error.

 

 

PS C:\WINDOWS\system32> Get-PowerBIWorkspace
Get-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized'
At line:1 char:1
+ Get-PowerBIWorkspace
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (Microsoft.Power...owerBIWorkspace:GetPowerBIWorkspace) [Get-PowerBIWorkspace], HttpOperationException
    + FullyQualifiedErrorId : Operation returned an invalid status code 'Unauthorized',Microsoft.PowerBI.Commands.Workspaces.GetPowerBIWorkspace

PS C:\WINDOWS\system32> Resolve-PowerBIError -Last


   HistoryId: 2


RequestId        : 05f5d685-34a9-4d80-9c3e-820fbb3ef520
Response         : Unauthorized (401): {"error":{"code":"UserNotLicensed","message":"User is not licensed for Power BI"}}
PowerBIErrorInfo : UserNotLicensed
ResponseDate     : Tue, 14 May 2019 14:29:29 GMT
RequestMethod    : GET
RequestUri       : https://api.powerbi.com/v1.0/myorg/groups?$top=100
InvocationInfo   : {Get-PowerBIWorkspace}
Line             : Get-PowerBIWorkspace
Position         : At line:1 char:1
                   + Get-PowerBIWorkspace
                   + ~~~~~~~~~~~~~~~~~~~~
StackTrace       :    at Microsoft.PowerBI.Api.V2.Groups.<GetGroupsWithHttpMessagesAsync>d__5.MoveNext()
                   --- End of stack trace from previous location where exception was thrown ---
                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                      at Microsoft.PowerBI.Api.V2.GroupsExtensions.<GetGroupsAsync>d__1.MoveNext()
                   --- End of stack trace from previous location where exception was thrown ---
                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
                      at Microsoft.PowerBI.Api.V2.GroupsExtensions.GetGroups(IGroups operations, String filter, Nullable`1 top, Nullable`1 skip)
                      at Microsoft.PowerBI.Common.Api.Workspaces.WorkspacesClient.GetWorkspaces(String filter, Nullable`1 top, Nullable`1 skip)
                      at Microsoft.PowerBI.Commands.Workspaces.GetPowerBIWorkspace.GetWorkspaces()
                      at Microsoft.PowerBI.Commands.Workspaces.GetPowerBIWorkspace.ExecuteCmdlet()
                      at Microsoft.PowerBI.Commands.Common.PowerBICmdlet.ProcessRecord()
HistoryId        : 2
0 REPLIES 0

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.