service principals authentication to SQL DB

Krishnamohan Nadimpalli 401 Reputation points
2022-08-24T05:06:47.657+00:00

Hi

I have a pipeline setup from ADSL to SQL which would truncate and insert data.

When I am giving truncate table in Pre-copy Script, it fails with permission error.

234315-image.png

234371-image.png

How permissions needs to be given in SQL DB to enable truncate table option. I have service principal ID in Linked Services and I need steps to be performed in SQL DB

234346-image.png

Azure SQL Database
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,478 questions
0 comments No comments
{count} votes

Accepted answer
  1. Nandan Hegde 29,886 Reputation points MVP
    2022-08-24T07:11:21.607+00:00

    Hey,

    CREATE USER [<<SP name>>] FROM EXTERNAL PROVIDER   
      
    exec sp_addrolemember 'db_owner', '<<SPName>>'  
       
      
    if min privelage:  
      
    exec sp_addrolemember 'db_ddladmin', '<<SPName>>'  
      
    

    Since the test connection in linked service is success and the job is failing only for truncate, so you need to execute either the ddladmin aspect for min privelage aspect or the db_owner with max privelage


0 additional answers

Sort by: Most helpful