Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I need help in creating a simple PowerShell script that will update my PBI report parameter.
Body:
{
"updateDetails": [
{
"name": "EndDate",
"newValue": "2020-06-08"
},
{
"name": "StartDate",
"newValue": "2020-06-01"
}
]
}
I'm not sure how to followup this code:
Invoke-PowerBIRestMethod -Url "/datasets/datasetID" -Method Post -Body .....
This is provided by the Microsoft documentation but i'm having trouble putting it into practice
Invoke-PowerBIRestMethod
-Url <String>
-Method <PowerBIWebRequestMethod>
[-Body <String>]
[-OutFile <String>]
[-ContentType <String>]
[-Headers <Hashtable>]
[-Organization <String>]
[-Version <String>]
[<CommonParameters>]
Thank you for your help!
Solved! Go to Solution.
I found it out:
# Update Parameters URL
$urlUpdateParams = '/datasets/{datasetId}/Default.UpdateParameters'
# Update Parameters Body
$body = '{
"updateDetails": [
{
"name": "EndDate",
"newValue": "2020-06-14"
},
{
"name": "StartDate",
"newValue": "2020-06-01"
}
]
}'
$content = 'application/json'
Invoke-PowerBIRestMethod -Url $urlUpdateParams -Method Post -Body $body -ContentType $content # Updates Dataset Parameters
Your API call is incomplete.
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/updateparameters (for regular workspaces)
https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/updateparametersingroup (for Premium)
Note that you are not updating report parameters. You are updating dataset parameters.
I found it out:
# Update Parameters URL
$urlUpdateParams = '/datasets/{datasetId}/Default.UpdateParameters'
# Update Parameters Body
$body = '{
"updateDetails": [
{
"name": "EndDate",
"newValue": "2020-06-14"
},
{
"name": "StartDate",
"newValue": "2020-06-01"
}
]
}'
$content = 'application/json'
Invoke-PowerBIRestMethod -Url $urlUpdateParams -Method Post -Body $body -ContentType $content # Updates Dataset Parameters
Did you run this through Powershell?
yes, after authenticating, for example with Login-PowerBI
I grabbed this script from github.
https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Update-Datas...
I modify the script using my entries.
I run it using Powershell.
No errors are thrown up but the parameters are not changing in the dataset.
Can you please inspect this script please.
I left comments after some of the lines below.
I'm totally new to running commands using Powershell. I'm trying to learn.
My goal is update the Parameters for a particular dataset.
Write-Host
Connect-PowerBIServiceAccount | Out-Null
$workspaceName = "me" //for myworkspace, do I use "me", or "My Workpace"?
$datasetName = "dataset123"
$workspaceId = $workspace.Id
$datasetId = $dataset.Id // is dataset.ID grabbed automatically?
$workspace = Get-PowerBIWorkspace -Name $workspaceName
$dataset = Get-PowerBIDataset | Where-Object Name -eq $datasetName
$workspaceId = $workspace.Id
$datasetId = $dataset.Id
$datasetParametersUrl = "groups/$workspaceId/datasets/$datasetId/Default.UpdateParameters"
$parameterName = "DirectPath_NonOneDrive_JSON"
$newParameterValue = "NewPath"
$postBody = "{updateDetails:[{name:'$parameterName', newValue:'$newParameterValue'}]}"
Invoke-PowerBIRestMethod -Url $urlUpdateParams -Method Post -Body $body -ContentType $content
Thank you.
I authenticated then attempted to run, but does not work for me.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
3 |