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! For credential details I found this in the documentation:
var credentialDetails = new CredentialDetails(
credentials,
CredentialTypeEnum.Basic,
EncryptedConnectionEnum.Encrypted,
EncryptionAlgorithmEnum.None,
PrivacyLevelEnum.Private);
Configure credentials programmatically for Power BI embedded analytics - Power BI | Microsoft Learn
I also found this documentation, but not sure if it is what you need or not: Python Implementation | microsoft/PowerBI-Developer-Samples | DeepWiki