-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
My web app tries to use ManagedIdentityCredential on local development computer #21075
Comments
Thank you for your feedback. Tagging and routing to the team members best able to assist. |
Hi @JandosHk |
Hi @christothes I tried logging today, but it seems that after using SharedTokenCacheCredential or VisualStudioCredential, the error has gone.
|
Does this still reproduce wit the latest version of Microsoft.Identity.Web (which uses version 1.3.0 of Azure.Identity) or after directly taking a dependency on the latest Azure.Identity 1.4.0? |
Today I installed Microsoft.Web.Identity 1.10.0 (which uses Azure.Identity 1.3.0). and the same error was thrown. Directly installing Azure.Identity 1.4.0 didn't help either. |
Thank you for trying the newer version. |
I enabled logging like below:
Is it correct? I couldn't find any example where listener variable is used. What I get on my VS2019 output window is below:
Looks similar to error page. |
BTW, my coworker is experiencing the same issue on her dev computer. |
Almost - you want to set the logging options on the I suspect that the logging will show that you have some device on the local network responding on the IP address |
I set logging like below:
Logging messages are below:
BTW, do you mean 169.254.169.254? |
Yes, I meant to say that IP address. I think we may be missing one more step on the logging. Can you try adding the following? // Setup a listener to monitor logged events.
using AzureEventSourceListener listener = AzureEventSourceListener.CreateConsoleLogger(); |
@christothes, I did it again and got the same log messages. The problem is I don't understand where that listener is referenced in the code? Just initializing it doesn't make a sense to me. |
Could you run the following PowerShell command? It will reveal which process is listening on the ip address Get-Process -Id (Get-NetTCPConnection -IPAddress 169.254.169.254).OwningProcess |
@christothes, somehow the error on my PC disappeared, but my coworker still facing the issue. On her computer, when she executed the command, the following error was thrown:
Then, she started our web app in debug mode (from VS2019 pressed F5), and executed the command again. This time she got the following:
Do you see something wrong in here? |
@christothes, BTW, in my PC, even after I started my web app, the command throws the error given above (and the web app works fine). |
I'm not sure why iisexpress would be using 169.254.169.254, but this is definitely the source of the problem. As a workaround for local development, you could add the following var options = new DefaultAzureCredentialOptions { ExcludeManagedIdentityCredential = true }; |
@chamons, thank you for your time. Let's close this issue. |
In ASP.NET Core 3.1 web app, I' m using Azure key vault configuration:
Azure.Identity v1.2.3 is installed transitively, when I installed Microsoft.Identity.Web v1.8.2.
It works on my local development computer, when I run my web app from within Visual Studio 2019, by pressing F5 (debug mode). I checked; the actual credential used was SharedTokenCacheCredential (by replacing DefaultAzureCredential with EnvironmentCredential, ManagedIdentityCredential, and SharedTokenCacheCredential in that order).
Now, in my new computer I installed Visual Studio 2019, git cloned my web app, and ran the web app.
The web app threw an exception: AuthenticationFailedException: ManagedIdentityCredential authentication failed: Retry failed after 4 tries.
Looks like, the web app is trying to use ManagedIdentityCredential in my local development computer (If I replace DefaultAzureCredential with SharedTokenCacheCredential, then it works in my new computer). Why is it happening?
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: