Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all!
I have done a powershell script for disable refeshes for selected datasets in an excel file.
I have only tested on my own dataset and it has been working well.
Now when I should run it on almost all datasets it says that I need to be the dataset owner to do this, see below.
I'm admin on the capacity and has admin permissions on the workspaces as well.
Can I force this even if I'm not the owner of the dataset?
# Login to Power BI
#Login-PowerBIServiceAccount
$choice = Read-Host "Do you want to ENABLE or DISABLE the refresh for the datasets? (Type 'enable' or 'disable' or other for exit)"
# Validate input and set the body accordingly
# Define the body for disabling/enabling refresh
switch ($choice.ToLower()) {
"enable" { $body = "{ 'value': { 'enabled': true } }" }
"disable" { $body = "{ 'value': { 'enabled': false } }" }
default {
Write-Host "Invalid choice. Please run the script again and type 'enable' or 'disable'."
exit
}
}
# Change this path to your location of the file when running.
$excelPath = "C:\Release25-37.xlsx"
# Read the Excel file
#$refreshTargets = Import-Excel -Path $excelPath -WorksheetName "RefreshTargets"
$refreshTargets = Import-Excel -Path $excelPath
# Show the user what will be updated
Write-Host "`nThe following datasets will be updated to $choice"
foreach ($target in $refreshTargets | Where-Object { $_.Include -eq "Y" }) {
Write-Host "GroupId: $($target.GroupId) | Workspace $($target.GroupIdName) | DatasetId: $($target.DatasetId) | DatasetIdName: $($target.DatasetIdName)"
}
# Ask for confirmation
$confirm = Read-Host "`nDo you want to proceed with $choice of these datasets? ([y]=yes/ [n]=no)"
if ($confirm.ToLower() -ne "y") {
Write-Host "Operation cancelled by user."
exit
}
# Proceed with update
# Filter and loop through each row marked for inclusion
foreach ($target in $refreshTargets | Where-Object { $_.Include -eq "Y" }) {
$groupId = $target.GroupId
$datasetId = $target.DatasetId
$url = "https://api.powerbi.com/v1.0/myorg/groups/$groupId/datasets/$datasetId/refreshSchedule"
Write-Host "INFO - Updating refresh schedule for Group: $groupId, Dataset: $datasetId"
Invoke-PowerBIRestMethod -Url $url -Method PATCH -Body $body
}
Solved! Go to Solution.
no you cannot, must own the model. A good best practice is to use a 'service account' to own the semantic models, and use that Entra Account to execute the refresh or disable
no you cannot, must own the model. A good best practice is to use a 'service account' to own the semantic models, and use that Entra Account to execute the refresh or disable
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!