请帮助我解决Azure Sql Windows模拟问题
存在一个使用服务层上的模拟功能的三层应用程序,以已启动客户端应用程序的用户身份连接到MS SQL。
Kerberos票证用于模拟服务中的客户端用户,如下所示:
SECURITY_HANDLE serverContext;
AcceptSecurityContext(ref inbound, ref serverContext, ref ClientToken, APIReference.ContextAttr, APIReference.SECURITY_NATIVE_DREP, out serverContext, out ServerToken, out uNewContextAttr, out NewLifeTime); // final handshake leg
ImpersonateSecurityContext(ref serverContext); //secur32.Dll
SqlConnection conn = new SqlConnection("Integrated Security=True") // works on MS SQL on premises
SqlConnection conn = new SqlConnection("Authentication=Active Directory Integrated"); // fails with Azure SQL (no impersonation is actually made)
RevertSecurityContext(ref _context); //secur32.Dll
但是,当在Azure SQL上使用Kerberos票证进行模拟(并在本地与MSSQL一起使用时,不会进行用户模拟。问题是SQL查询是在AzureSQL上以服务用户帐户而不是客户端用户帐户执行的。
是否可以使用Azure SQL进行Kerberos票证模拟工作?
我知道有EXECUTE AS LOGIN功能可用于模拟Sql Server上的用户。但是我想让Kerberos模拟工作正常。
UPD:我已使用adal.dll on service连接AzureSQL
我知道,如果将LogonUser
令牌与WindowsIdentity.Impersonate()
组合一起使用,则模拟在AzureSQL上有效。
是否可以使用Azure SQL进行Kerberos票证模拟工作?
没有Azure SQL数据库支持SQL Server身份验证和Azure Active Directory身份验证。不是Windows NT身份验证的两种形式的NTLM或Kerberos。
[可能可以使用“ Azure Active Directory Integrated”身份验证,该身份验证为将帐户复制到Azure Active Directory的Windows用户提供了single sign-on,并且不需要进行多重身份验证。