This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi everyone,
I am trying to add a file type data source using REST API, however it is failing. I have tried with Service Principal as well as a usual user with PBI Pro license and admin rights on the gateway but no luck. I am wondering if I can get some help and can be guided in the right direction.
My calls are as below
JSON For data source connection
{
"datasourceName": "testDataSource",
"credentialDetails": {
"encryptedConnection": "Encrypted",
"credentialType": "Windows",
"credentials": {
"UserName": "<user_name_or_service_principal_ID>",
"Password": "System.Security.SecureString"
},
"privacyLevel": "Organizational",
"encryptionAlgorithm": "None"
},
"dataSourceType": "=File",
"connectionDetails": "{\"FilePath\":\"C:\\Working\\some.csv\"}"
}
REST API End Point
https://api.powerbi.com/v1.0/myorg/gateways/<gateway_id>/datasources
Error
Invoke-WebRequest : The remote server returned an error: (400) Bad Request.
Thanks
Kaz
Hi @Anonymous ,
Please refer the following posts, they might be helpful.
If it doesn’t meet your requirement, we suggest you to open a ticket here for help: https://powerbi.microsoft.com/en-us/support/
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 8 | |
| 8 |
| User | Count |
|---|---|
| 48 | |
| 27 | |
| 25 | |
| 24 | |
| 22 |