Forum Discussion
RogerSteinberg
Post Patron
6 years agoUpdate parameters through Powershell
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"
...
- 6 years ago
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
lbendlin
Super User
6 years agoYour 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.
RogerSteinberg
Post Patron
6 years agoI 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- roncruiser1 year ago
Post Patron
Did you run this through Powershell?
- lbendlin1 year ago
Super User
yes, after authenticating, for example with Login-PowerBI
- roncruiser1 year ago
Post Patron
I authenticated then attempted to run, but does not work for me.