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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mkjit256
Advocate I
Advocate I

Do i need to be a in a workspace to get dataset refresh through Invoke-PowerBIRest?

Hello

I am using the code from this blog

 

 

Connect-PowerBIServiceAccount

$Workspaces = Get-PowerBIWorkspace -Scope Organization

foreach($workspace in $Workspaces)

{

$DataSets = Get-PowerBIDataset -WorkspaceId $workspace.Id | where {$_.isRefreshable -eq $true}

foreach($dataset in $DataSets)

{

$URI = "groups/" + $workspace.id + "/datasets/" + $dataset.id + "/refreshes"

$Results = Invoke-PowerBIRestMethod -Url $URI -Method Get

Write-Host $Results

}}

 

I am able to get all the workspaces and datasets in the organization, using Get-PowerBIworkspace and Get-PowerBIDataset in the Foreach loops. 

 

However when i use

 

 Invoke-PowerBIRestMethod -Url $URI -Method Get

 

, i am only getting the refresh date of Datasets that are found to workspaces where i was added as a member. 

How can i get the refresh date of all datasets in my organization?
am i missing any permission for reading the datasets in organization using Invoke-PowerBIRestMEthod but not using Get-PowerBIDataset

 

1 ACCEPTED SOLUTION

@Daryl-Lynch-Bzy Thanks for your reply. It helped me finding this (which was exactly what i was looking for):

Admin - Get Refreshables - REST API (Power BI Power BI REST APIs) | Microsoft Learn

View solution in original post

4 REPLIES 4
mkjit256
Advocate I
Advocate I

Thanks for your reply @Daryl-Lynch-Bzy  Sorry for mis explaining, I am a power BI Adminstrator (I thought anyone that can get the Dataset with -scope organization, is a power bi Admin, and that is why id didn't mention it before). 

I believe that you mean by "to run the Admin API calls", is to connect to powerbi-services using my admin activated account, right? If yes, then this is exactly what i am doing, but i am unable to get the refresh dates for dataset unless they are in the workspace that i was added in? any possible explanations. 

mkjit256_0-1674266558737.png

and here is what i am getting as output: 

mkjit256_2-1674266766509.png

 

 

Hi @mkjit256 - there is a difference between normal and admin API calls.  If a Power BI Administrator runs the normal API calls they will only see results for the workspaces where they are members.  Take the following examples:

Groups - Get Groups - REST API (Power BI Power BI REST APIs) | Microsoft Learn

GET https://api.powerbi.com/v1.0/myorg/groups

 

Admin - Groups GetGroupsAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn

GET https://api.powerbi.com/v1.0/myorg/admin/groups?$top={$top}

 

The first require workspace access.  The second allows admin to see the groups without actually providing access to the underlying data.

 

If you think about the following API call:

Datasets - Execute Queries - REST API (Power BI Power BI REST APIs) | Microsoft Learn

POST https://api.powerbi.com/v1.0/myorg/datasets/{datasetId}/executeQueries

 The Power BI Administrator should have access to run unless they are granted access to use the Dataset. 

@Daryl-Lynch-Bzy Thanks for your reply. It helped me finding this (which was exactly what i was looking for):

Admin - Get Refreshables - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @mkjit256  - Yes.  You account would need to be Admin or Member of each Workspace to run the type of API.  The alternative is to run the Admin API calls if you are Power BI Administrator or to use a Service Principal.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

Top Kudoed Authors