Forum Discussion
Anonymous
5 years agoNot applicable
Update credentials for paginated report with AAS as data source
Hi,
I'm trying to update the credentials for a paginated report that is published to Power BI Service. The report uses Azure Analysis Services as data source and when publishing the report the authentication is set to OAuth2.
I have tried searching for documentation and other peoples solutions but I cannot get it working.
Can someone verify if it's supposed to work in some way?
First try was using the UpdateDatasources from the Reports API like this:
$DatasourceBody =
'{
"updateDetails": [
{
"datasourceName": "AS",
"connectionDetails": {
"server": "server=asazure://westeurope.asazure.windows.net/xxx",
"database": "xxx"
},
"connectionDetails": {
"server": "server=asazure://westeurope.asazure.windows.net/xxx",
"database": "xxx"
},
"credentialDetails": {
"credentialType": "OAuth2",
"credentials": "{\"credentialData\":[{\"name\":\"accessToken\", \"value\":\"'+ $accessToken +'"}]}",
"encryptedConnection": "Encrypted",
"encryptionAlgorithm": "None",
"privacyLevel": "None"
}
}
]
}'
Invoke-PowerBIRestMethod -Url $UpdateDataSourceURL -Method Post -Body $DatasourceBody
Result = 400 bad request
The second try was using the UpdateDatasources from the Gateway API and PATCH method like this:
$UpdateUserCredential =
'{
"credentialDetails": {
"credentialType": "OAuth2",
"credentials": "{\"credentialData\":[{\"name\":\"accessToken\", \"value\":\"'+ $accessToken +'"}]}",
"encryptedConnection": "Encrypted",
"encryptionAlgorithm": "None",
"privacyLevel": "None"
}
}'
Invoke-PowerBIRestMethod -Url "gateways/$($Dataset.value.gatewayId)/datasources/$($Dataset.value.datasourceId)" -Method PATCH -Body $UpdateUserCredential
Result 400 bad request
Is there anyone that have done such a thing and can clarify how this should work?
No Replies