K2 blackpearl Installation and Configuration Guide > Prerequisites > Environment Configuration > User Authentication and Security > K2 Pass-Through Authentication > Credentials Delegation > Dynamic SQL Service Impersonation > Dynamic SQL Server Configuration Requirements | Send feedback |
The following configuration prerequisites are required
![]() |
These scripts need to be run once per SQL Server instance. |
For each SQL Server Instance, the following mappings need to be created:
The above configuration enables the SQL Server to resolve the AD group or user by associating the Windows SID to a SQL SID.
![]() |
Both AD Groups and AD Users can be added that you can set up a whole AD Group as a LOGIN, it needn’t just be an AD User: |
Associate Windows SID to SQL SID |
Copy Code
|
---|---|
USE [master]; --Represent caller SID within SQL CREATE LOGIN [Domain\SqlUsers] FROM WINDOWS; --Represent service account SID within SQL CREATE LOGIN [Domain\K2Service] FROM WINDOWS; GO |
The Grant IMPERSONATION rights on the K2 Host Server service account script enables the following actions:
Grant Impersonation Rights |
Copy Code
|
---|---|
USE [master]; --Allow one SID to impersonate as the other GRANT IMPERSONATE ON LOGIN::[Domain\SqlUsers] TO [Domain\K2Service]; GO |
The Impersonation rights granted above must be mapped to a database user:
Map Server Login to the Local Database Principle |
Copy Code
|
---|---|
USE [SalesDB]; --Map server LOGIN to a local database principle, in this case using --the same name for convenience (can also use a different USER name) CREATE USER [Domain\SqlUsers] FOR LOGIN [Domain\SqlUsers]; GO |
![]() |
Running this script would not normally be required, but if it is required then only once per SQL Server Instance |
Grant User Rights |
Copy Code
|
---|---|
USE [SalesDB]; |