Forum Discussion
daive
1 year agoRegular Visitor
Script a new connection
Hi all, Is it possible to script a new connection? As in this action: This is my script, its failing with a 404 Not Found $tenantId = "<tenant-id>"
$clientId = "<client-id>"
$clie...
- 1 year ago
Hi daive , I think
- connectionDetails must be a JSON string (not nested).
- credentials must be Base64-encoded.
- Credentials must be encrypted using the gateway's public key.
- And Ensure you have relevant API Permissions
If this post helped please do give a kudos and accept this as a solution
Thanks In Advance
daive
1 year agoRegular Visitor
According to https://learn.microsoft.com/en-us/rest/api/power-bi/gateways/create-datasource#sql-example
The body should be formatted like this:
{
"dataSourceType": "SQL",
"connectionDetails": "{\"server\":\"MyServer\",\"database\":\"MyDatabase\"}",
"datasourceName": "Sample Datasource",
"credentialDetails": {
"credentialType": "Windows",
"credentials": "AB....EF==",
"encryptedConnection": "Encrypted",
"encryptionAlgorithm": "RSA-OAEP",
"privacyLevel": "None"
}
}
I need to set more options and my script looks ok?
- Akash_Varuna1 year agoSuper User
Hi daive , I think
- connectionDetails must be a JSON string (not nested).
- credentials must be Base64-encoded.
- Credentials must be encrypted using the gateway's public key.
- And Ensure you have relevant API Permissions
If this post helped please do give a kudos and accept this as a solution
Thanks In Advance