Forum Discussion
Unable to create Datasource on PowerBI API
- 10 months ago
Hi nk-alex ,
Great question unfortunately, DAX in Power BI is just for calculations and modeling, so it can't make REST API calls, handle encryption, or talk to gateways. The datasource creation you're working on happens outside of Power BI, so you'll need to use something like PowerShell, Postman, or a backend script in Python or C# to get that done.
If you just want to see or build the JSON body, Power Query can help with that, but it still can't do encryption or actually create the datasource through the API. Those parts have to be done with external tools to keep things secure.
So, DAX isn't able to test or set up this process you'll need an external tool that can handle encryption and REST API requests.
Thank you.
Hi nk-alex ,
It sounds like the issue is most likely related to how the credentials are being encrypted before they’re sent through the API. The gateway requires that the credentials are encrypted using its public key, which you can obtain by calling the public key endpoint for your gateway.
Once you have that, make sure the credential JSON is encrypted with RSA-OAEP (SHA-1) so that it matches what the gateway expects. In your request, you’ll also want to double-check that the encryption algorithm is set to RSA-OAEP, the encrypted connection setting is set to Encrypted, and the privacy level is set appropriately to either Private or Organizational.
Another important step is to confirm that the MySQL ODBC connector is installed on the machine running the gateway and that you’re able to connect successfully from Power BI Desktop with the same credentials. If that connection works locally, the API call should go through as well once the encryption is configured correctly.
If you’ve already gone through these steps and it’s still giving you trouble, let us know and we can help you dig a little deeper.
Thank you,
Tejaswi.