Fabric mirroring is a feature in Microsoft Fabric that lets you create a read-only replica of data from an external source—such as Azure SQL Database, SQL Server, or Snowflake—inside Fabric's OneLake. This replica is continuously updated, so you can analyze near-real-time data without impacting the source system. To set up fabric mirroring, you need a Fabric capacity (or trial), a supported source, and the necessary permissions. The steps below walk you through the requirements and configuration.
What You'll Need
- A Microsoft Fabric workspace with a capacity (F2 or higher, or a trial capacity).
- A supported source database: Azure SQL Database, Azure SQL Managed Instance, SQL Server 2016 or later, or Snowflake. (Support varies; check current documentation.)
- Network connectivity between Fabric and the source. For on-premises or private sources, a data gateway is required.
- Credentials with read access to the source database and permission to create objects (for change tracking setup).
- In Fabric, you need at least Contributor role in the workspace to create a mirrored database.
- For SQL Server sources, change tracking must be enabled on the database and tables you want to mirror.
Step-by-Step
- Verify source support and prerequisites. Confirm your source type and version are supported. For SQL Server, enable change tracking at the database level:
ALTER DATABASE [YourDB] SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON);Then enable it on each table:ALTER TABLE [YourTable] ENABLE CHANGE_TRACKING;For Azure SQL Database, change tracking is enabled similarly. For Snowflake, ensure the account has the necessary privileges. - Set up connectivity. If your source is on-premises or in a private network, install and configure an on-premises data gateway in the same network, and add the gateway to Fabric. For cloud sources, ensure firewall rules allow Fabric's IP ranges (see Microsoft documentation for current ranges).
- Create a mirrored database in Fabric. In your Fabric workspace, select New > Mirrored database. Choose your source type (e.g., Azure SQL Database, SQL Server, Snowflake). Provide the connection details: server name, database name, and authentication method (SQL authentication or service principal). If using a gateway, select it.
- Select tables to mirror. After connecting, Fabric lists the tables in the source. Choose the tables you want to replicate. Note that only tables with a primary key can be mirrored. You can also choose to mirror all tables.
- Configure mirroring settings. Specify the mirroring mode (continuous or on-demand). Continuous mirroring keeps the replica up to date with changes. You can also set the retention period for historical data if needed.
- Start mirroring. Review the settings and click Create. Fabric provisions the mirrored database and begins the initial snapshot. The time taken depends on data size. You can monitor progress in the Fabric workspace.
- Verify the replica. Once mirroring is active, you can query the mirrored data using the SQL analytics endpoint or via Power BI. Check that data is updating by comparing a few rows with the source.
Common Mistakes
- Forgetting to enable change tracking. Without it, mirroring will fail for SQL Server and Azure SQL sources.
- Using a source without a primary key. Tables without a primary key cannot be mirrored; you must add one or exclude the table.
- Insufficient permissions. The credentials used must have read access to the database and, for change tracking setup, ALTER permissions. In Fabric, the user needs Contributor or higher.
- Network misconfiguration. If using a gateway, ensure it is online and the source is reachable. For cloud sources, check firewall rules.
- Ignoring capacity limits. Mirroring consumes Fabric capacity; ensure your capacity has enough resources, especially for large datasets.
Tips
- Start with a small subset of tables to test the setup before scaling up.
- Monitor the mirroring status regularly in the Fabric workspace to catch issues early.
- Use the SQL analytics endpoint to query mirrored data without affecting the source.
- Consider using a service principal for authentication to avoid password changes disrupting the connection.
- For large tables, schedule the initial snapshot during off-peak hours to minimize impact on the source.
Troubleshooting
If mirroring fails or stops updating, check these common issues:
- Connection errors: Verify the gateway is running and the source is accessible. Test the connection in Fabric settings.
- Change tracking not enabled: Run the ALTER DATABASE and ALTER TABLE commands as shown in step 1.
- Permissions issues: Ensure the credentials have the necessary rights. For SQL Server, the user needs at least db_owner or specific permissions for change tracking.
- Capacity throttling: If mirroring is slow, check capacity utilization in the Fabric admin portal. Consider scaling up or pausing other workloads.
- Table without primary key: Remove the table from mirroring or add a primary key.
If the issue persists, review the mirroring logs in the Fabric workspace or consult Microsoft's official documentation for error codes.
Frequently Asked Questions
Can I mirror data from an on-premises SQL Server?
Yes, but you need an on-premises data gateway installed in your network and configured in Fabric.
Does fabric mirroring support all data types?
Most common data types are supported, but some specialized types (e.g., geography, hierarchyid) may not be. Check the documentation for your source.
How often does mirrored data update?
Continuous mirroring updates near-real-time, typically within minutes. The exact latency depends on source activity and capacity.
Can I modify the mirrored data?
No, the mirrored database is read-only. You can query it but not write to it.
What happens if I delete a table from the source?
The mirrored table will remain but stop updating. You should remove it from the mirroring configuration.
Is there a cost for fabric mirroring?
Mirroring consumes Fabric capacity units. Costs depend on your capacity size and the amount of data mirrored. Refer to Microsoft's pricing page for details.