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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.