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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
powerbi_jenhen
Resolver II
Resolver II

Service Principle cannot Get-PowerBIWorkspace

Hi,

 

I'm trying to use the Power BI Rest API via Powershell authenticating with my service principle to retrieve a workspaceid for a given named workspace via "Get-PowerBIWorkspace", unfortunately I receive "Get-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized'"?? Do service principles not have access to this API? I can access via "Login-PowerBIServiceAccount" authenticating with my Power BI Admin account so I guess not. How can I re-write the below for the APIs a service principle can access?...

 

$WorkspaceName = "Test Workspace"

#Get PBI workspace attributes
$Workspace = Get-PowerBIWorkspace -Scope Organization -Name $WorkspaceName
$WorkspaceId = $Workspace.Id
Write-Host "Workspace ID: "$WorkspaceId
1 ACCEPTED SOLUTION
powerbi_jenhen
Resolver II
Resolver II

Fixed this by removing "-Scope Organization"

 

That was surprisingly easy 🙂

View solution in original post

1 REPLY 1
powerbi_jenhen
Resolver II
Resolver II

Fixed this by removing "-Scope Organization"

 

That was surprisingly easy 🙂

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.