Posts

Showing posts from May, 2020

"Only active directory users can impersonate other active directory users" when accessing an Azure SQL Database

Image
Not long ago I faced the following error. System.Data.SqlClient.SqlException (0x80131904): Only active directory users can impersonate other active directory users.    at System.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__180_0(Task`1 result)    at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()    at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown ---    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) ...so on... Everything looked correct (such as the connection string containing the credential to connect the database was correct and the user seemed to have the correct permissions as well) therefore, I spent some time understanding further about SQL. I did find some MSDN article talking about “EXECUTE AS” however, I still