Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered
Hi Fabric Community,
I'm exploring the possibility of automating the setup of database mirroring for new SQL Server databases on a single Azure Managed SQL Server instance. According to the official documentation, it seems like the connection for database mirroring must be manually configured through the Azure portal for each individual database.
Given the need to streamline this process, I’m wondering:
The goal is to eliminate the manual step of creating the mirroring connection in the portal whenever a new database is created.
Looking forward to hearing your insights and suggestions!
Thanks in advance!
Solved! Go to Solution.
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 10
Hope 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
Hi @dlhfabric ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the community members for the issue worked. If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Thanks and regards
Hi @dlhfabric ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution so other members can easily find it.
Thanks and regards
Hi @dlhfabric,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thank you.
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
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 10
Hope 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
Hi @dlhfabric ,
Thanks for reaching out to the Microsoft fabric community forum.
If by configuring new databases you mean enabling System Assigned Managed Identity (SAMI) of your Azure SQL Managed Instance creating a login and mapped database user, to automate this you need to use Azure CLI
Configure managed identities on Azure virtual machines (VMs) - Managed identities for Azure resource...
By utilizing Fabric rest api you can speed up the process of creating mirrored Azure SQL instances
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Fabric update to learn about new features.
User | Count |
---|---|
56 | |
28 | |
18 | |
10 | |
4 |
User | Count |
---|---|
50 | |
50 | |
26 | |
8 | |
6 |