Add Azure SQL Database CDC source to an eventstream (preview)

This article shows you how to add an Azure SQL Database Change Data Capture (CDC) source to an eventstream.

The Azure SQL Database CDC source connector for Microsoft Fabric event streams allows you to capture a snapshot of the current data in an Azure SQL database. The connector then monitors and records any future row-level changes to this data. Once the changes are captured in the eventstream, you can process this CDC data in real-time and send it to different destinations within Fabric for further processing or analysis.

Important

Enhanced capabilities of Fabric event streams are currently in preview.

Note

This source is not supported in the following regions of your workspace capacity: West US3, Switzerland West.

Prerequisites

  • Access to the Fabric premium workspace with Contributor or higher permissions.
  • A running Azure SQL server with an Azure SQL database.
  • Your Azure SQL database must be publicly accessible and not be behind a firewall or secured in a virtual network.
  • Enabled CDC in your Azure SQL database by running the stored procedure sys.sp_cdc_enable_db. For details, see Enable and disable change data capture.

Note that you must not enable mirroring in your Azure SQL database.

Note

The maximum number of sources and destinations for one eventstream is 11.

Enable CDC in your Azure SQL Database

  1. Go to the Azure portal, open your Azure SQL database, and select Query editor. Choose an authentication method to log in.

    A screenshot of opening Azure SQL database.

  2. Execute the following SQL commands to enable CDC in your database:

    -- Enable Database for CDC
    EXEC sys.sp_cdc_enable_db;
    
    -- Enable CDC for a table using a gating role option
    EXEC sys.sp_cdc_enable_table
        @source_schema = N'dbo',
        @source_name   = N'MyTable',
        @role_name     = NULL
    GO
    
  3. After the query executes successfully, you have enabled CDC in your Azure SQL database.

    A screenshot of enabling Azure SQL CDC.

Add Azure SQL Database CDC as a source

  1. Select Eventstream to create a new eventstream. Make sure the Enhanced Capabilities (preview) option is enabled.

    A screenshot of creating a new eventstream.

  2. On the next screen, select Add external source.

    A screenshot of selecting Add external source.

Configure and connect to Azure SQL Database CDC

  1. On the Select a data source screen, select Azure SQL DB (CDC).

    A screenshot of selecting Azure SQL DB (CDC).

  2. On the Connect page, select New connection.

    Screenshot that shows the Connect page of the Get events wizard with the **New connection** link highlighted.

  3. In the Connection settings section, enter the following values for your Azure SQL database:

    • Server: Enter the Azure SQL server name from the Azure portal.

    • Database: Enter the Azure SQL database name from the Azure portal.

      Screenshot that shows the Connection settings section of the New connection page.

  4. Scroll down, and in the Connection credentials section, follow these steps.

    • For Connection name, enter a name for the connection.

    • For Authentication kind, select Basic.

      Note

      Currently, Fabric event streams supports only Basic authentication.

    • Enter Username and Password for the database.

  5. Select Connect.

    Screenshot that shows the Connection credentials section of the New connection page.

  6. Now, on the Connect page, enter the following information:

    • Select All tables or enter the table names separated by commas, such as: dbo.table1, dbo.table2
    • For Port, the default value is 1433 and cannot be modified.
  7. Select Next.

    Screenshot that shows the Connect page of the Get events wizard filled.

  8. On the Review and create screen, review the summary, and then select Add.

    Screenshot that shows the Review and create page of the Get events wizard filled.

You can see the Azure SQL Database (CDC) source added to your eventstream in Edit mode.

Screenshot of streaming Azure SQL Database CDC source in Edit view.

To implement this newly added Azure SQL Database CDC source, select Publish. After you complete these steps, your Azure SQL Database CDC source is available for visualization in the Live view.

A screenshot of streaming Azure SQL Database CDC source in Live view.

Other connectors: