Why does CDC table function fail silently when sent from ADF but not SSMS?

Allen, Phil 0 Reputation points
2025-09-04T16:40:03.43+00:00

I have an ADF Lookup Activity query calling a CDC table function on an on-prem SQL server. I'm trying to call sys.fn_cdc_get_net_changes_my_table. Initially, when we called this function from ADF, we received a single row with all NULL values as a response, even if the LSN inputs passed in were invalid. The exact same function call, from the same user account, worked as expected when sent from SSMS.

We determined by trial and error that adding the cdc_admin role to the user allowed the query to work from ADF.

Two questions:

  1. Why is this role required to call the table function from ADF, but not from SSMS? Is this intended behavior or a bug?
  2. If there's a permissions issue, why doesn't the table function fail or return an error, rather than send an incorrect response? This also feels like a bug.
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 128.3K Reputation points MVP Volunteer Moderator
    2025-09-04T20:56:14.4033333+00:00

    If it works from SSMS and not from ADF that is because the login you use from SSMS has the required permissions, in difference to the login from ADF. The topic for cdc.fn_cdc_get_net_changes says this in the permission section:

    Requires membership in the sysadmin fixed server role or db_owner fixed database role. For all other users, requires SELECT permission on all captured columns in the source table and, if a gating role for the capture instance was defined, membership in that database role. When the caller does not have permission to view the source data, the function returns a row with NULL values for all the columns.

    I would guess your SSMS user has the SELECT permissions needed (or is an admin).


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.