LinqPad 6 RC - Error connecting to AzureSQL using AzureAD credentials

edited September 21
Hi,

I just downloaded the current LinqPad 6 RC (did not use a beta version) but my stored LinqPad 5 connections using AzureAD (Active Directory) credentials do not work. Neither does re-creating the connection in LinqPad. This seems to be some issue in .NET Core 3.0, but maybe you can take a look? I used the pre-start screen from LinqPad itself to install the X86 .Net Core version.

I am getting the error message: Keyword not supported: 'authentication'.

I am using my Azure AD user name that I have set up as "AD Admin" on the AzureSQL database server.

Connecting via "Active Directory - Universal with MFA Support (interactive)" works, but not when specifying via "Username and Password" and checking "Active Directory"



The full connection string (via the advanced dialog) is identical in LinqPad 5 and 6

Data Source=xxx.database.windows.net;Authentication=Active Directory Password;User [email protected];Password=Whatever;app=LINQPad;Encrypt=true

I could supply you with an empty database and Azure AD credentials to connect against if needed.

Thanks again for the awesome tool, our company could not work without it. Been using it since Version 4 :-)

Comments

  • Sure - if you can send me a test database Azure AD credentials, that would help in coming up with a solution. You can sent it via a PM or via the form at https://www.linqpad.net/Feedback.aspx
  • Thanks! I just sent you the test credentials and DB server via PM
  • I've released another build with a fix - let me know how it works for you.
  • edited September 23
    I installed the current RC (different PC than last 2 days, work vs home) but got a NullReferenceException instead. This NullRef also affects the "universal with MFA support" setting.
    ---------------------------
    LINQPad
    ---------------------------
    NullReferenceException - Object reference not set to an instance of an object.
    
    Source=LINQPad.Drivers.LinqToSql
    
    
    
     -LINQPad.Drivers.LinqToSql.DynamicDriver System.String GetAccessToken(System.String, Boolean, System.String) offset: 0x1B6
    
     -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
    
     -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw(System.Exception) offset: 0x0
    
     -LINQPad.SystemExtensions Void ThrowWithOriginalStackTrace(System.Exception) offset: 0x1
    
     -LINQPad.Extensibility.DataContext.DataContextDriver System.Object RunInCachedDriverProcessCore(System.String, System.Object[]) offset: 0x20
    
     -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
    
     -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw(System.Exception) offset: 0x0
    
     -LINQPad.SystemExtensions Void ThrowWithOriginalStackTrace(System.Exception) offset: 0x1
    
     -LINQPad.ExecutionModel.FastChannel+<>c__DisplayClass44_0`2 U b__0(T) offset: 0x52
    
     -LINQPad.ExecutionModel.Proxy`1 System.Threading.Tasks.Task`1[TResult] Eval[TResult](System.Linq.Expressions.Expression`1[System.Func`2[TRemote,TResult]]) offset: 0x2A
    
     -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
    
     -System.Runtime.CompilerServices.TaskAwaiter Void ThrowForNonSuccess(System.Threading.Tasks.Task) offset: 0x27
    
     -System.Runtime.CompilerServices.TaskAwaiter Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task) offset: 0x28
    
     -System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter TResult GetResult() offset: 0xB
    
     -LINQPad.TaskExtensions+d__43`2 Void MoveNext() offset: 0x101
    
     -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw() offset: 0x11
    
     -System.Runtime.ExceptionServices.ExceptionDispatchInfo Void Throw(System.Exception) offset: 0x0
    
     -LINQPad.SystemExtensions Void ThrowWithOriginalStackTrace(System.Exception) offset: 0x1
    
     -LINQPad.TaskExtensions T GetResult[T](System.Threading.Tasks.Task`1[T]) offset: 0x7D
    
     -LINQPad.Extensibility.DataContext.DriverProxy`1 TResult Eval[TResult](System.Linq.Expressions.Expression`1[System.Func`2[T,TResult]], Boolean) offset: 0x20
    
     -LINQPad.AppHost System.Object RunInCachedDriverProcess(System.String, System.String, System.String, System.String, System.Object[]) offset: 0xDF
    
    
    
    
    
    First Chance Data:
    
       -LINQPad.Drivers.LinqToSql.DynamicDriver.GetAccessToken(loginName,noPrompt,cxString) offset=0x1B6
    
       -System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() offset=0x11
    
       -System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(source) offset=0x0
    
       -LINQPad.SystemExtensions.ThrowWithOriginalStackTrace(ex) offset=0x1
    
       -LINQPad.Extensibility.DataContext.DataContextDriver.RunInCachedDriverProcessCore(methodName,args) offset=0x20
    
       -System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() offset=0x11
    
       -System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw(source) offset=0x0
    
       -LINQPad.SystemExtensions.ThrowWithOriginalStackTrace(ex) offset=0x1
    
       -LINQPad.ExecutionModel.FastChannel+<>c__DisplayClass44_0`2.b__0(x) offset=0x52
    
       -LINQPad.ExecutionModel.Proxy`1.Eval(remoteMethod) offset=0x2A
    
       -System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() offset=0x11
    
       -System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(task) offset=0x27
    
       -System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(task) offset=0x28
    
       -System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter.GetResult() offset=0xB
    
       -LINQPad.TaskExtensions+d__43`2.MoveNext() offset=0x101
    
       -System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() offset=0x11
    ---------------------------
    OK   
    ---------------------------
    
  • Unfortunately, the NRE is hiding something deeper which I can't reproduce either on a dev machine or Windows Sandbox. There's a chance that it could be a race, so I've pushed out another update that avoids the race. Let me know what happens.

    AD support is complex in that it relies on starting a .NET Framework process to open a SQL connection and extract the access token from the connection via reflection. It then has to send the token back to the .NET Core process so that it can assign it to its own SQL connection.
  • edited September 23
    It works with the new update :-)

    I can confirm that the AD Login now works in Linqpad 6 with both the "MFA interactive" Mode and the "Username and Password" Mode. Thanks for the quick fix. I will remove the test DB server and user again then, if you do not need them anymore currently.

    Time to upgrade our Enterprise license then :D

    edit: Will do another test on my PC at home later today and give a final feedback
  • I can confirm that it also works from the first PC at home after the automatic update, thanks for the quick fix :-)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!