Forum Discussion
Problem in Update Datasource Power BI REST API Call
- Anonymous3 years ago
I found the answer. For using WIndows credentials, first the credentials need to be encrypted to a credential string.
The python example is given here - https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python/Encrypt%20credentials
Hey Anonymous did you try to use the following format?
"credentials": "{\"credentialData\":[{\"name\":\"username\", \"value\":\"john\"},{\"name\":\"password\", \"value\":\"*****\"}]}"
Let me know if this works:)
- Anonymous3 years agoNot applicable
Anonymous
I tried your format. It is not working. Gave an PrimitiveValue error. Then I tried the same format within curly brackets and I get the following error.
{ "error": { "code": "BadRequest", "message": "Bad Request", "details": [ { "message": "The property 'credentials' does not exist on type 'Microsoft.PowerBI.ServiceContracts.Api.GatewayDatasource'. Make sure to only use property names that are defined by the type.", "target": "datasourceDelta" } ] } }- Anonymous3 years agoNot applicable
I see. This means that with "credentialtype" Windows we are not allow to use the format above. Did you try with Basic Credentials? https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource#basic-credentials-example
- Anonymous3 years agoNot applicable
Anonymous Yes I did. I tried various combinations too, it didn't work. But I learnt that we have to encrypt the Windows Username and password into a single string and use that as credential. So I am now trying to find the way to do that encryption in Python. (I made a new question)