Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hi folks,
I'm currently working on implementing a full refresh for Power BI datasets on a weekly basis, with the goal of overwriting the existing incremental refresh policy. I'm using the XMLA endpoint via PowerShell scripts, I've tried using the PowerBI-Powershell cmdlets, without successfully overwriting the incremental refresh policy.
I'm now trying to use SSAS method, Invoke-ASCmd and Invoke-Processasdatabase commands, but I'm encountering an error (please refer to the attached screenshot for details).
Downgrading libraries, isn't a feasible option in our environment.
Could you please advise on:
Appreciate your guidance!
Solved! Go to Solution.
We used ActiveBatch scheduler to trigger this powershell script.
SqlServer library latest version is not compatible use
Sqlserver = 21.1.18256
Microsoft.Identity.Client - 4.53.0
Microsoft.PowerBImgmt - 1.2.1111
PowerShell - 5.1
For Full dataset refresh add applyrefreshpolicy = 'false' instead of partitions in the xmla body.
Final Script:
param(
[Parameter(Mandatory = $true)]
[string]$WorkspaceName,
[Parameter(Mandatory = $true)]
[string]$GroupId,
[Parameter(Mandatory = $true)]
[string]$DatasetName
)
# Credentials
$AppId = # Service PRincipal ID
$TenantId = "TenantID"
$ClientSecret = # Secret from Service Principal
# Creating secure string & credential for Application ID and client secret
$PbiSecurePassword = ConvertTo-SecureString $ClientSecret -Force -AsPlainText
$PbiCredential = New-Object Management.Automation.PSCredential($AppId, $PbiSecurePassword)
# Connect to the Power BI Service Account
Write-Output "Connecting to Power BI Service Account..."
Connect-PowerBIServiceAccount -ServicePrincipal -TenantId $TenantId -Credential $PbiCredential
Write-Output "Successfully connected to Power BI Service Account"
# Get the Dataset ID of the Target Dataset
Write-Output "Getting datasets for workspace: $GroupId"
$Datasets = Get-PowerBIDataset -WorkspaceId $GroupId
$DatasetId = ($Datasets | Where-Object { $_.Name -eq $DatasetName }).Id.Guid
Write-Output "Dataset ID for $DatasetName : $DatasetId"
# Set execution policy for the session
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# Define the required SqlServer module version
$requiredVersion = "21.1.18256"
# Check if the required version is installed
if (Get-InstalledModule -Name SqlServer -RequiredVersion $requiredVersion -ErrorAction SilentlyContinue) {
Import-Module SqlServer -RequiredVersion $requiredVersion
Write-Host "Imported SqlServer module version $requiredVersion."
} else {
Write-Error "SqlServer module version $requiredVersion is not installed. Please install it before running this script."
exit 1
}
# Define JSON refresh command as a variable
$jsonRefresh = @"
{
"refresh": {
"type": "full",
"objects": [
{
"database": "Your Dataset",
"table": "Your Table",
"partition": "Your Partition"
}
]
}
}
"@
# Save JSON to a temporary file
$tempJsonPath = "$env:TEMP\refresh_command.json"
$xmlaEndpoint = "powerbi://api.powerbi.com/v1.0/myorg/$WorkspaceName"
# Run the command
try {
Write-Output "Triggering dataset refresh..."
Invoke-ASCmd -Server $xmlaEndpoint -InputFile $tempJsonPath -ServicePrincipal -ApplicationId $AppId -TenantId $TenantId -Credential $PbiCredential
Write-Output "Successfully triggered a Power BI Dataset Refresh."
}
catch {
Write-Error "Failed to trigger dataset refresh."
}
We used ActiveBatch scheduler to trigger this powershell script.
SqlServer library latest version is not compatible use
Sqlserver = 21.1.18256
Microsoft.Identity.Client - 4.53.0
Microsoft.PowerBImgmt - 1.2.1111
PowerShell - 5.1
For Full dataset refresh add applyrefreshpolicy = 'false' instead of partitions in the xmla body.
Final Script:
param(
[Parameter(Mandatory = $true)]
[string]$WorkspaceName,
[Parameter(Mandatory = $true)]
[string]$GroupId,
[Parameter(Mandatory = $true)]
[string]$DatasetName
)
# Credentials
$AppId = # Service PRincipal ID
$TenantId = "TenantID"
$ClientSecret = # Secret from Service Principal
# Creating secure string & credential for Application ID and client secret
$PbiSecurePassword = ConvertTo-SecureString $ClientSecret -Force -AsPlainText
$PbiCredential = New-Object Management.Automation.PSCredential($AppId, $PbiSecurePassword)
# Connect to the Power BI Service Account
Write-Output "Connecting to Power BI Service Account..."
Connect-PowerBIServiceAccount -ServicePrincipal -TenantId $TenantId -Credential $PbiCredential
Write-Output "Successfully connected to Power BI Service Account"
# Get the Dataset ID of the Target Dataset
Write-Output "Getting datasets for workspace: $GroupId"
$Datasets = Get-PowerBIDataset -WorkspaceId $GroupId
$DatasetId = ($Datasets | Where-Object { $_.Name -eq $DatasetName }).Id.Guid
Write-Output "Dataset ID for $DatasetName : $DatasetId"
# Set execution policy for the session
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# Define the required SqlServer module version
$requiredVersion = "21.1.18256"
# Check if the required version is installed
if (Get-InstalledModule -Name SqlServer -RequiredVersion $requiredVersion -ErrorAction SilentlyContinue) {
Import-Module SqlServer -RequiredVersion $requiredVersion
Write-Host "Imported SqlServer module version $requiredVersion."
} else {
Write-Error "SqlServer module version $requiredVersion is not installed. Please install it before running this script."
exit 1
}
# Define JSON refresh command as a variable
$jsonRefresh = @"
{
"refresh": {
"type": "full",
"objects": [
{
"database": "Your Dataset",
"table": "Your Table",
"partition": "Your Partition"
}
]
}
}
"@
# Save JSON to a temporary file
$tempJsonPath = "$env:TEMP\refresh_command.json"
$xmlaEndpoint = "powerbi://api.powerbi.com/v1.0/myorg/$WorkspaceName"
# Run the command
try {
Write-Output "Triggering dataset refresh..."
Invoke-ASCmd -Server $xmlaEndpoint -InputFile $tempJsonPath -ServicePrincipal -ApplicationId $AppId -TenantId $TenantId -Credential $PbiCredential
Write-Output "Successfully triggered a Power BI Dataset Refresh."
}
catch {
Write-Error "Failed to trigger dataset refresh."
}
Hi @SpaneshSingams ,
we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,
Chaithanya
Hi @SpaneshSingams ,
Thank you for reaching out to Microsoft Fabric Community Forum.
Can you check with below steps to resolve your issue.
# Define parameters
$clientId = "YOUR_CLIENT_ID"
$clientSecret = "YOUR_CLIENT_SECRET"
$tenantId = "YOUR_TENANT_ID"
$groupId = "WORKSPACE_ID" # Power BI Workspace ID
$datasetId = "DATASET_ID" # Power BI Dataset ID
# Get auth token
$body = @{
grant_type = "client_credentials"
client_id = $clientId
client_secret = $clientSecret
scope = "https://analysis.windows.net/powerbi/api/.default"
}
$tokenResponse = Invoke-RestMethod -Method Post -Uri "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token" -Body $body
$token = $tokenResponse.access_token
# Trigger full refresh
$refreshUrl = "https://api.powerbi.com/v1.0/myorg/groups/$groupId/datasets/$datasetId/refreshes"
$refreshBody = @{
notifyOption = "MailOnFailure"
type = "Full"
} | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri $refreshUrl -Headers @{Authorization = "Bearer $token"} -Body $refreshBody -ContentType "application/json"
Write-Output "Full refresh triggered successfully."
Regards,
Chaithanya.
RestAPI method doesn't bypass the incremental policy setup, we tried using this but endup with no success.
Analysis service XMLA Endpoint is the only way to bypass incremental setup.
Hi @SpaneshSingams ,
we would like to follow up to see if the solution provided by the super user resolved your issue. Please let us know if you need any further assistance.
If our super user response resolved your issue, please mark it as "Accept as solution" and click "Yes" if you found it helpful.
Regards,
Chaithanya
You can just try to publish your sematic model into service (again).
The initial load of the model shoulb be triggered doing this. The next refresh should go incremental again.
Regards
We are trying to automate the process, every weekend it gonna trigger full refresh.
What about the capability to track data changes?
No option for you in that case?
You will need another date (maybe datatime) column where Service is looking at.
So you can avoid the full refresh.
But we don't know your setup
Our incremental setup captures modified data within a defined date range over a specific period. However, if changes occur outside of that range, a full dataset refresh becomes necessary to ensure data accuracy. To address this, we plan to automate a full data refresh every weekend using PowerShell.
You would be best off calling the enhanced refresh API, specifying a "full" refresh on any table with incremental refresh on it. This is reload data into archived partitions
We tried that too, but only picking incremental tables and partitions. Not bypassing the policy.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.