I want to define a default constraint on a table which shows that a specific user performed the DML operations on a table.
I define columns as below:
CreatedByUser varchar(50) default system_user
While running the query from the SSMS with my own Id - it gives me correct result i.e. my email ID
When I run the DML operations on the same table through ADF with linked service supporting MSI - I don't get name of the principal ( Data Factory name) - rather I get something like below:
Can someone please help here?
1条答案
按热度按时间wlsrxk511#
I created a table with below columns
I inserted some data into MyTabel through Azure SQL query panel and created stored procedure to run insert values into MyTable as below:
I created ADF user and assigned roles to the user using below code:
I created linked service for Azure SQL database through MSI authentication.
I executed stored procedure with Id, Name parameters executed the pipeline.
when select data from MyTable with
select * from [dbo].[MyTable]
, I got below output.I add new column to the table bu using
alter table [dbo].[MyTable] add c_user varchar(50)
and updated below stored procedure as belowI added dynamic content as
@pipeline().DataFactory
in c_user parameter in stored procedure parameters and executed it.I select the data from MyTable with
select * from [dbo].[MyTable]
I got my ADF name in 'c_user' column.