Add Azure SQL Database Change Data Capture (CDC) as source in Real-Time hub (preview)

This article describes how to get events from Azure SQL Database Change Data Capture (CDC) into Fabric Real-Time hub. The Azure SQL Database CDC source connector 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.

Note

Real-Time hub is currently in preview.

Prerequisites

  • Get access to the Fabric premium workspace with Contributor or above permissions.
  • A running Azure SQL server with an Azure SQL database.
  • Membership in the sysadmin fixed server role for the SQL Server, and db_owner role on the database.
  • CDC enabled on your Azure SQL database by running the stored procedure sys.sp_cdc_enable_db. For details, see Enable and disable change data capture.

Note

  • Mirroring shouldn't be enabled in your database.
  • Multiple tables CDC isn't supported.

Get events from an Azure SQL Database CDC

You can get events from an Azure SQL Database CDC into Real-Time hub in one of the ways:

  • Using the Get events experience
  • Using the Microsoft sources tab

Launch Get events experience

  1. Switch to the Real-Time Intelligence experience in Microsoft Fabric. Select Microsoft Fabric on the left navigation bar, and select Real-Time Intelligence.

    Screenshot that shows how to switch to the Real-Time Intelligence experience.

  2. Select Real-Time hub on the left navigation bar.

    Screenshot that shows how to launch Real-Time hub In Microsoft Fabric.

  3. On the Real-Time hub page, select + Get events in the top-right corner of the page.

    Screenshot that shows the selection of Get events button in Real-Time hub.

Use instructions from the Add Azure SQL Database CDC as a source section.

Microsoft sources tab

  1. In Real-Time hub, switch to the Microsoft sources tab.

  2. In the Source drop-down list, select Azure SQL DB (CDC).

  3. For Subscription, select an Azure subscription that has the resource group with your SQL database.

  4. For Resource group, select a resource group that has your SQL database.

  5. For Region, select a location where your SQL database is located.

  6. Now, move the mouse over the name of the SQL database that you want to connect to Real-Time hub in the list of databases, and select the Connect button, or select ... (ellipsis), and then select the Connect button.

    Screenshot that shows the Microsoft sources tab with filters to show SQL databases and the connect button for an Azure SQL database.

    To configure connection information, use steps from the Add Azure SQL Database CDC as a source section. Skip the first step of selecting Azure SQL DB (CDC) as a source type in the Get events wizard.

Add Azure SQL Database CDC as a source

  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 Go to resource to navigate to the Azure SQL database. Take a note of the server name on the Overview page. It's in the following format: myazuresqlserver.database.windows.net.

    Screenshot that shows the Connect page with Go to resource link highlighted.

  3. On the Connect page, select New connection.

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

  4. 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.

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

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

    2. For Authentication kind, select Basic.

      Note

      Currently, Fabric event streams supports only Basic authentication.

    3. Enter Username and Password for the database.

    4. Select Connect.

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

  6. Now, on the Connect page, do these steps:

    1. Enter the name of the SQL table.

    2. For Port, Enter the port number (default is 1433).

    3. In the Stream details section to the right, select the Fabric workspace where you want to save the eventstream that the Wizard is going to create.

    4. For eventstream name, enter a name for the eventstream. The wizard creates an eventstream with the selected Azure SQL Database CDC as a source.

    5. The Stream name is automatically generated for you by appending -stream to the name of the eventstream. You see this stream on the Data streams tab of Real-Time hub when the wizard finishes.

    6. Select Next.

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

  7. On the Review and create screen, review the summary, and then select Create source.

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

View data stream details

  1. On the Review and create page, if you select Open eventstream, the wizard opens the eventstream that it created for you with the selected Azure SQL Database CDC as a source. To close the wizard, select Close at the bottom of the page.

    Screenshot that shows the Review and create page after successful creation of the source.

  2. In Real-Time hub, switch to the Data streams tab of Real-Time hub. Refresh the page. You should see the data stream created for you as shown in the following image.

    Screenshot that shows the Data streams tab of Real-Time hub with the stream you just created.

    For detailed steps, see View details of data streams in Fabric Real-Time hub.

To learn about consuming data streams, see the following articles: