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

The Fabric community is now in read-only for platform upgrade. Learn more

Reply
h4tt3n
Helper V
Helper V

Update parameter via Powershell API call

Hello, I am having some difficulties updating a dataset parameter via the PBI rest api. I am using PowerShell and "Import-Module MicrosoftPowerBIMgmt".

I have based my script on these ressources:
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/updateparameters
https://community.powerbi.com/t5/Developer/Update-parameters-through-Powershell/td-p/1167203

I am pretty sure I got the syntax right, but the script *sometimes* returns an error, and I can't see any cange in the dataset after running it.

 

I have defined a string parameter named ReportVersion which I am trying to update. The parameter has "enable load" checked off and is visible in the report.

 

This is how I attempt to do it:

 

 

Connect-PowerBIServiceAccount

$datasetId = "my dataset id"

$urlUpdateParams = "https://api.powerbi.com/v1.0/myorg/datasets/$($datasetId)/Default.UpdateParameters"

$body = '{
    "updateDetails": [
    {
        "name": "ReportVersion",
        "newValue": "2.0"
    }
    ]
}'

$content = 'application/json'

write-host $urlUpdateParams
                
Invoke-PowerBIRestMethod -Url $urlUpdateParams -Method POST -Body $body -ContentType $content

Disconnect-PowerBIServiceAccount

 

 

The error I get looks like this:

 

 

Invoke-PowerBIRestMethod : One or more errors occurred.
At C:\...\Power BI report upload tool 10.ps1:83 char:17
+ ...             Invoke-PowerBIRestMethod -Url $urlUpdateParams -Method PO ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
    + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

 

 

Can you help me pinpoint what is going wrong?

 

Thanks in advance,

Mike

 

3 REPLIES 3
Anonymous
Not applicable

Hi @h4tt3n,

How many requests did you send? Request data size? AFAIK, rest API has its usage limitation, you can take a look at the official document to confirm if your test has exceeded the limits.

Power BI REST API limitations 

Regards,

Xiaoxin Sheng

I am not POST'ing any data to the dataset, just small querys to update parameters or refresh datasets. I find it very hard to believe that these queries should exceeded the daily limit.

Anonymous
Not applicable

Hi @h4tt3n,

Any other operations based on rest API with your power bi contents? In addition, you can also try to remove the front part of the URL, this part seems not to use in the document samples:

 

$urlUpdateParams = "/datasets/$($datasetId)/Default.UpdateParameters"

 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.