Forum Discussion
Change Source Connection on Mirrored Database
- 4 months ago
Hi andyparkerson,
Hope you're doing well!
There is no option in the Fabric portal to swap the connection on an existing Mirrored Database. The connection is set at creation time and the UI does not expose a way to change it directly.
Solution :
The Fabric Mirroring Public REST API supports updating a mirrored database's definition, including the connection property in the source configuration. https://learn.microsoft.com/en-us/fabric/mirroring/mirrored-database-rest-api
So, you can do this without recreating the item by doing it step by step:
- Call GET https://api.fabric.microsoft.com/v1/workspaces/<workspaceId>/mirroredDatabases/<mirroredDatabaseId>/getDefinition to retrieve the current definition.
- In the returned JSON, locate the source.typeProperties.connection field and replace the old connection ID with your new one.
- Call POST .../updateDefinition with the modified payload.
The definition structure (JSON) looks like this:
{
"properties": {
"source": {
"type": "<your source type>",
"typeProperties": {
"connection": "<NEW-CONNECTION-ID>",
"database": "your-db-name"
}
}
}
}
You can find your new connection ID by going to: Settings → Manage connections and gateways → [your connection] → Settings → Connection ID.
Hope this helps! Feel free to tell us if that works. Don't forget to mark as solution and thumbs up, that's motivate me to keep helping 🙂
Best regards,
Oussama (Data Consultant - Expert Fabric & Power BI)
- 4 months ago
Hey andyparkerson,
Agree with oussamahaimoud on the REST API approach. But there's an important prerequisite: the Connection ID (and database name) can only be updated when mirroring status is Initialized or Stopped.
Before calling updateDefinition API directly:
- Stop mirroring via the portal or Stop Mirroring API.
- Confirm status via getMirroringStatus.
- Call updateDefinition with the new connection ID.
- Restart mirroring.
Heads up on restart: After swapping the connection, expect a full re-initialization. Existing data in OneLake is preserved, but every table will be fetched from scratch. So, plan your re-sync window accordingly.
Useful link: Fabric Mirroring Public REST API - Microsoft Fabric | Microsoft Learn
Please do share if it works without stopping mirroring first, or any useful findings.
Hope this helps!
Best,
Harshit
Hey andyparkerson,
Agree with oussamahaimoud on the REST API approach. But there's an important prerequisite: the Connection ID (and database name) can only be updated when mirroring status is Initialized or Stopped.
Before calling updateDefinition API directly:
- Stop mirroring via the portal or Stop Mirroring API.
- Confirm status via getMirroringStatus.
- Call updateDefinition with the new connection ID.
- Restart mirroring.
Heads up on restart: After swapping the connection, expect a full re-initialization. Existing data in OneLake is preserved, but every table will be fetched from scratch. So, plan your re-sync window accordingly.
Useful link: Fabric Mirroring Public REST API - Microsoft Fabric | Microsoft Learn
Please do share if it works without stopping mirroring first, or any useful findings.
Hope this helps!
Best,
Harshit
Harshit,
Thanks so much for this heads up. I definitely would have tried to update without stopping first.
It is important to know that when you stop the replication, restarting it pulls down a complete copy of the tables. So people should bare that in mind when scheduling the restart.
Thanks again,
Andy
- stoic-harsh4 months ago
Super User
Hey Andy,
Glad it helped😊
Best,
Harshit