Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi there,
I need to create a data source on a gateway that connects to an on-premises SQL Server.
I have understood that I need to RSA-OAEP encrypt the credentials (Basic username/password), for which I've found examples in Power shell and in c# (Configure credentials programmatically for Power BI )
Is there any way to encrypt the credentials with Node or using an API-based third-party service?
Thanks!
Solved! Go to Solution.
In case this helps anyone seekeing a solution for the sale problem, here's what I did.
I used a PowerShell script as described here https://endjin.com/blog/2020/12/how-to-update-credentials-for-an-on-prem-power-bi-data-source-using-... then executed ith with Node, retrieving the resulting JSON. The Node code looks like this
```javascript
const { exec } = require('child_process');
const PShellScriptFile = './rsa-oeap-encrypt-credentials.ps1'
const datasourceCredentialsEncryptedFile = "./datasourceCredentialsEncryptedFile.json"
var username = "useNameHere"
var password = "passwordHere"
// WARNING. Gateway module is fixed and should go as param
exec(`${PShellScriptFile} -username ${username} -password ${password} -outputFile ${datasourceCredentialsEncryptedFile}`, {'shell':'powershell.exe'}, (error, stdout, stderr)=> {
// you can use stdout but I choose getting the JSON file already generated by the script
})
```The outcome looks like this
{
"credentialDetails": {
"encryptedConnection": "Encrypted",
"credentialType": "Basic",
"credentials": "oCvURzaedv3WNvV...lRQZ",
"privacyLevel": "Private",
"encryptionAlgorithm": "RSA-OAEP"
}
}Which you can then use in Gateways - Create Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Docs
In case this helps anyone seekeing a solution for the sale problem, here's what I did.
I used a PowerShell script as described here https://endjin.com/blog/2020/12/how-to-update-credentials-for-an-on-prem-power-bi-data-source-using-... then executed ith with Node, retrieving the resulting JSON. The Node code looks like this
```javascript
const { exec } = require('child_process');
const PShellScriptFile = './rsa-oeap-encrypt-credentials.ps1'
const datasourceCredentialsEncryptedFile = "./datasourceCredentialsEncryptedFile.json"
var username = "useNameHere"
var password = "passwordHere"
// WARNING. Gateway module is fixed and should go as param
exec(`${PShellScriptFile} -username ${username} -password ${password} -outputFile ${datasourceCredentialsEncryptedFile}`, {'shell':'powershell.exe'}, (error, stdout, stderr)=> {
// you can use stdout but I choose getting the JSON file already generated by the script
})
```The outcome looks like this
{
"credentialDetails": {
"encryptedConnection": "Encrypted",
"credentialType": "Basic",
"credentials": "oCvURzaedv3WNvV...lRQZ",
"privacyLevel": "Private",
"encryptionAlgorithm": "RSA-OAEP"
}
}Which you can then use in Gateways - Create Datasource - REST API (Power BI Power BI REST APIs) | Microsoft Docs
Hi @dpiret ,
Please check the content of the following documents and we hope they will help you to achieve your needs.
An example of RSA Encryption implemented in Node.js
Implementing RSA Encryption and Signing in Node.js (With Examples)
(Node.js) RSA-OAEP with SHA256 hashing
Best Regards
Thanks, @Anonymous I already tried but none worked for me.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |