Forum Discussion
FABRIC REST API Connections - Create Connection
Hi,
Here's a working body structure for SQL Server + Service Principal:
$body = @{
connectivityType = "ShareableCloud"
displayName = "SQL Server Connection"
connectionDetails = @{
type = "SQL"
creationMethod = "SQL"
parameters = @(
@{ dataType = "Text"; name = "server"; value = "yourserver.database.windows.net" },
@{ dataType = "Text"; name = "database"; value = "yourdatabase" }
)
}
privacyLevel = "Organizational"
credentialDetails = @{
credentialType = "ServicePrincipal"
credentials = @{
tenantId = "your-tenant-id"
servicePrincipalClientId = "your-client-id"
servicePrincipalSecret = "your-client-secret"
}
singleSignOnType = "None"
connectionEncryption = "Encrypted"
skipTestConnection = $false
}
} | ConvertTo-Json -Depth 10
Call it against api.fabric.microsoft.com directly, double check field casing against current docs since it's picky.
If this helped, feel free to give it a kudos or mark it as solution, helps others find it too.