Forum Discussion
raghav20
2 years agoFrequent Visitor
Automate Dataset Refresh with PowerShell Scripts
Dear Members, I am trying to Automate Dataset refersh using Power shell script, which is failing and throwing following error. Invoke-PowerBIRestMethod : One or more errors occurred. At line...
ducky
Advocate I
2 years agohi raghav20
If you connect with the SPN you dont need to get a token. at least in my case i dont have to.
Is your SPN using a certificate or a secret? if its a certificate then its a bit different call.
Are you using SPN Profiles in each Workspace? if thats the case then in your headers you will need to put this:
$SPHeader = @{'X-PowerBI-profile-id' = $profileId}
# Make the API call
Invoke-PowerBIRestMethod -Url $url -Method POST -Headers $SPHeader
where $profileId is returned by calling the api to get your profile id.