Blog Post

Azure Database Support Blog
2 MIN READ

Cannot enable Change Data Capture (CDC) on Azure SQL Database: Msg 22830 + Error 40529 (SUSER_SNAME)

Mohamed_Baioumy_MSFT's avatar
Feb 27, 2026

Issue

While enabling CDC at the database level on Azure SQL Database using:

EXEC sys.sp_cdc_enable_db;
GO

the operation fails.

Error

The customer observed the following failure when running sys.sp_cdc_enable_db:

  • Msg 22830: Could not update the metadata that indicates the database is enabled for Change Data Capture. 
  • Failure occurred when executing drop user cdc 
  • Error 40529: "Built-in function 'SUSER_SNAME' in impersonation context is not supported in this version of SQL Server."

What we checked (quick validation)

Before applying any changes, we confirmed CDC wasn’t partially enabled and no CDC artifacts were created:

-- Is CDC enabled for this database?
SELECT name, is_cdc_enabled
FROM sys.databases
WHERE name = DB_NAME();
-- Does CDC schema exist?
SELECT name
FROM sys.schemas
WHERE name = 'cdc';
-- Does CDC user exist?
SELECT name
FROM sys.database_principals
WHERE name = 'cdc';

These checks were used during troubleshooting in the SR. 
(Also note: Microsoft Learn documents that enabling CDC creates the cdc schema/user and requires exclusive use of that schema/user.)

Cause

In this case, the failure aligned with a known Azure SQL Database CDC scenario: enabling CDC can fail if there is an active database-level trigger that calls SUSER_SNAME()

To identify active database-level triggers, we used:

SELECT name, object_id
FROM sys.triggers
WHERE parent_class_desc = 'DATABASE'
AND is_disabled = 0;

Resolution / Workaround

The customer resolved the issue by:

  1. Identifying the active database-level trigger
  2. Disabling the trigger temporarily. 
  3. Enabling CDC at the database level and then enabling CDC on the required tables
  4. Re-enabling the trigger after CDC was successfully enabled.

Post-resolution verification

After enabling CDC, you can validate the state using:

-- Confirm CDC enabled at DB level
SELECT name, is_cdc_enabled
FROM sys.databases
WHERE name = DB_NAME();

And for table-level tracking, Microsoft Learn recommends checking the is_tracked_by_cdc column in sys.tables.

Notes / Requirements

  • To enable CDC for Azure SQL Database, db_owner is required.
  • Azure SQL Database uses a CDC scheduler (instead of SQL Server Agent jobs) for capture/cleanup.

 

Published Feb 27, 2026
Version 1.0
No CommentsBe the first to comment