Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Can't add data source to data gateway with rest API

hello,
I have problem with adding data source to data gateway using rest API
according to documentation available here:
https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/createdatasource
and here:
https://docs.microsoft.com/en-us/rest/api/power-bi/gateways/updatedatasource#basic_credentials_examp...

using powershell I created a simple script
that should add new datasource to a data gateway unfortunately it always finish with http error 400 (bad request)

script:

$postParams = [ordered]@{
"dataSourceType" = "SQL"
"connectionDetails" = @{"server" = $dbServerName; "database" = $dbName } 
"credentialDetails" = [ordered]@{
"credentialType" = "Basic"
"credentials"= @{
"credentialData" = @(
[ordered]@{"name" = "username"; "value" = $dbUserName },[ordered]@{"name" = "password"; "value" = $dbUserPwd }
)
}
"encryptedConnection"= "Encrypted"
"encryptionAlgorithm"= "None"
"privacyLevel"= "None"

}
"datasourceName"= $datasourceName
}
$jsonPostBody = $postParams | ConvertTo-JSON -Depth 99

$uri = "https://api.powerbi.com/v1.0/myorg/gateways/$($gatewayID)/datasources"
$datasource = Invoke-RestMethod -Uri $uri -Headers $auth_header -Method POST -Body $jsonPostBody

is it some missing information i documentation or am I doing something wrong?

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

I would suggest you to create a support ticket here.

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

hi @v-yuta-msft,

I filed a ticket and it was successfully submitted (Case 119052922001462) unfortunately after 24h  I didn't get any feedback/contact from Support

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors