-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] SecretClient.GetSecret using an InteractiveBrowserCredential hangs indefinitely #18418
Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist. |
Key Vault can't return a response until you authenticate. Are you seeing a browser window pop up? Are you doing this in an environment without a window manager (e.g. WSL on Windows does not yet support a window manager, or perhaps on linux with no X server running)? If this happens after authenticating via the browser, please be sure to log additional calls so we can see why the connection is not authenticating (or whatever else is going on). |
I'm running a Windows application in Windows, or more specifically, I'm creating a DLL for a 3D CAD program that uses my DLL to transfer data to a database. I'm using Key Vault to store connection strings and such. When I use GetSecretAsync the browser login screen appears, and I can retrieve the secret successfully. Here's the log:
|
@HenningNT Can you still reproduce this with the latest GA version of Azure.Identity? |
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
I've experienced this same problem in 1.3.0 Azure.Identity. I can also call the async version just fine and it will pop up a login box. The sync version does not display a login box and the application hangs indefinitely. Oddly enough (and this might be me being a very novice programmer), the identical lines in a console app works fine and has the desired outcome (async and sync) but a Windows app sync call just hangs. Was hoping when I found this thread it wouldn't be abandoned hoping for a fix.... |
Thanks @bherrsk - Could you reproduce with logging enabled and send the output? You should be able to enable such logging by adding an event source listener somewhere in your process startup. using AzureEventSourceListener listener = new AzureEventSourceListener(
(e, message) => Console.WriteLine("[{0:HH:mm:ss:fff}][{1}] {2}", DateTimeOffset.Now, e.Level, message),
level: EventLevel.Verbose); More information around logging and diagnostics can be found in the Azure.Identity readme, as well as the Azure.Core diagnostics documentation. |
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
Flipped code back. There is no login window that pops up at all. The application hangs indefinitely. Removed some information I figured... would not be useful. I can always turn on more but got tied up recently and had to come back to this.
|
Are you able to start the same browser (default browser) standalone? Does it create a new process group (parent process plus child processes like renders, per-frame processes, etc.), or parent to the same process group? While rare, I've seen both parent processes for Chrome and Edge (both Chromium) hang and prevent other windows from opening until killed. If that's the case, @christothes, one idea might be to make sure we start a new process group. |
I've watched during process explorer and there is no additional processes being spawned. I've flipped the default browser around from Chrome to Edge (well, both Chromium) and Firefox. No change in behavior. All browsers operate as expected. Tried execution with pre-existing browsers open / closed, no change. I've monitored during execution using process monitor and I don't see anything out of the ordinary or the browser throwing some sort of indicators it's even trying to launch (or something to indicate problems). The application and system logs are clean. |
@bherrsk Thanks providing all the information here it was very helpful in the investigation. I've been able to reproduce the issue, and was able to root cause it. The Azure.Identity library is using Microsoft.Identity.Client (MSAL) to do the actual authentication, and MSAL is actually launching the browser. When running in a UI application such as WPF or Winforms on full framework, or in UWP, MSAL launches an embedded browser rather than launching the system browser as a separate process. This posses a problem with how we were waiting on the token response, as it was blocking MSAL from launching the embedded browser. With some experimentation I found that executing the MSAL call with Task.Run resolves this deadlock, though I'm not 100% sure this is the best fix it does work. I've created the PR linked above, and hope to get a fix merged before our next release. |
Sounds good. As well (not sure if I said this before), flipping to GetSecretAsync and using await displays the browser window properly as expected. My use case is extremely simple and exploratory at this point and I suspect the snippet below is not completely ideal. I'm also not a Developer by trade..... so there is that :)
|
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
update example files (Azure#18418) (Azure#18510) * update example files * format update * update profile examples to include frontdoorId and originResponseTimeout * update profile and endpoint location to global * address comment * fix sp example * address comments and fix the provisioningState for create examples * fix casing
Describe the bug
Calling SecretClient.GetSecret using an InteractiveBrowserCredential hangs indefinitely. Problem also in latest in main branch. It appear to hang in class AbstractAcquireTokenParameterBuilderExtensions when calling builder.ExecuteAsync(cancellationToken).GetAwaiter().GetResult();
Expected behavior
I would have expected the call to return Response with a secret.
Actual behavior
Calling SecretClient.GetSecret using an InteractiveBrowserCredential hangs indefinitely.
To Reproduce
Environment:
Azure.Identity v1.2.1
Azure.Identity.KeyVault.Secrets v4.0.3
Windows 10 .NET Framework 4.6.1
Visual Studio 16.8.4
Windows 10 .NET Framework 4.8]
The text was updated successfully, but these errors were encountered: