Forum Discussion
Automating Database Mirroring for New Databases on Azure Managed SQL Server
- 1 year ago
Hi dlhfabric ,
So we can use Fabric Rest API to automate the creation of Cloud connection
Connections - Create Connection - REST API (Core) | Microsoft Learn
Here is an example of it in powershell :$apiUrl = "https://api.fabric.microsoft.com/v1/connections" $requestBody = @{ connectivityType = "ShareableCloud" displayName = "ContosoCloudConnection" connectionDetails = @{ type = "SQL" creationMethod = "SQL" parameters = @( @{ dataType = "Text" name = "server" value = "contoso.database.windows.net" }, @{ dataType = "Text" name = "database" value = "sales" } ) } privacyLevel = "Organizational" credentialDetails = @{ singleSignOnType = "None" connectionEncryption = "NotEncrypted" skipTestConnection = $false credentials = @{ credentialType = "Basic" username = "admin" password = "xyz" } } } | ConvertTo-Json -Depth 10 $headers = @{ "Authorization" = "YOUR_ACCESS_TOKEN" "Content-Type" = "application/json" } $response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers $headers -Body $requestBody $response | ConvertTo-Json -Depth 10Hope this will meet your requirements to get started in creating a new connection with REST API.
Please make a note that this feature is still in preview mode.Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to give "Kudos"
Thanks and Regards
Hello v-nmadadi-msft ,
Thank you for responding. No, I did not mean how to set up identities and authentication. I'm asking how to automate fabric data source connection creation for azure managed sql server database. Documentation mentions this needs to be done through portal manually. I'm interested in automating this part.
Thanks and Regards
- v-nmadadi-msft1 year agoCommunity Support
Hi dlhfabric ,
So we can use Fabric Rest API to automate the creation of Cloud connection
Connections - Create Connection - REST API (Core) | Microsoft Learn
Here is an example of it in powershell :$apiUrl = "https://api.fabric.microsoft.com/v1/connections" $requestBody = @{ connectivityType = "ShareableCloud" displayName = "ContosoCloudConnection" connectionDetails = @{ type = "SQL" creationMethod = "SQL" parameters = @( @{ dataType = "Text" name = "server" value = "contoso.database.windows.net" }, @{ dataType = "Text" name = "database" value = "sales" } ) } privacyLevel = "Organizational" credentialDetails = @{ singleSignOnType = "None" connectionEncryption = "NotEncrypted" skipTestConnection = $false credentials = @{ credentialType = "Basic" username = "admin" password = "xyz" } } } | ConvertTo-Json -Depth 10 $headers = @{ "Authorization" = "YOUR_ACCESS_TOKEN" "Content-Type" = "application/json" } $response = Invoke-RestMethod -Uri $apiUrl -Method Post -Headers $headers -Body $requestBody $response | ConvertTo-Json -Depth 10Hope this will meet your requirements to get started in creating a new connection with REST API.
Please make a note that this feature is still in preview mode.Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to give "Kudos"
Thanks and Regards