Forum Discussion
FABRIC REST API Connections - Create Connection
- 19 days ago
Hi
$body = @{
connectivityType = "ShareableCloud"
displayName = "SQL Server Connection"
connectionDetails = @{
type = "SQL"
creationMethod = "SQL"
parameters = @(
@{ dataType = "Text"; name = "server"; value = "XXX" },
@{ dataType = "Text"; name = "database"; value = "XXX" }
)
}
privacyLevel = "Organizational"
credentialDetails = @{
singleSignOnType = "None"
connectionEncryption = "Encrypted"
skipTestConnection = $false
credentials = @{
credentialType = "ServicePrincipal"
tenantId = "XXX"
servicePrincipalClientId = "XXX"
servicePrincipalSecret = "XXX"
}
}
} | ConvertTo-Json -Depth 10
The body structure looks right for a ShareableCloud SQL connection with Service Principal authentication.
A couple of things I’d verify:
- the service principal has access to the SQL source
- the app/service principal has the required Fabric permissions
- tenantId, servicePrincipalClientId, and secret are all valid
- ConvertTo-Json -Depth 10 is kept, otherwise nested credential objects may be truncated
For debugging, I’d also inspect the final JSON before the API call:
$body
If the request still fails, the HTTP response body from Invoke-PowerBIRestMethod should help identify whether the issue is authentication, permissions, or the connection payload itself.