-
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
KeyVault - SecretClient.GetSecret(string key) return Status: 401 (Unauthorized) #9737
Comments
//cc: @annelo-msft, @schaabs |
@heaths can you please take a look? |
@macchmie3 just to confirm, you are seeing |
@heaths |
This appears to be a race condition in the challenge cache which we should synchronize. Will try to repro. |
wrapping |
I'm able to repro this but with other work pending for our March release we may need to punt till after that since a workaround - agreeably not ideal - is available. BTW, just a tip: there is an implicit cast operator for KeyVaultSecret secret = _secretClient.GetSecret(key); |
@heaths |
I feel like there should be a stronger warning on the main page about using this package in production if concurrent requests cause failures... |
Fixes Azure#9737 and fixes Azure#10657
I believe I have a fix and was hoping you could try it to verify before we release it, given the nature of this problem is impacted by machine and scenario differences.
Please let me know if this solves your problem and we'll get a release out on nuget.org. Thank you. |
I will check it today! |
@heaths |
Thanks for verifying the fix. We want to do some additional testing to make sure we didn't regress anything and fixed all the related issues here, and will get a servicing release out on nuget.org shortly. |
Great timing. I was just getting this same error, but only when using |
Add swagger definition for user assigned identity (Azure#9737)
Add swagger definition for user assigned identity (Azure#9737)
@heaths Need your help on this, I have updated the nuget package Azure.Security.KeyVault.Secrets -Version 4.0.3, also tried 4.1.0. Could you please help on this. Regards, |
Please open a new issue and provide diagnostic information as described here: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/keyvault/Azure.Security.KeyVault.Secrets/README.md#troubleshooting You can also capture logs using ETW without changing code using |
Hi @heaths |
Just wanted to note that we will also consider a challenge-free auth flow as well: #15651 |
Describe the bug
When I am calling SecretClient.GetSecret(key) I am sometimes getting:
Azure.RequestFailedException: Status: 401 (Unauthorized)
. This method is usually called multiple times in parallel using single instance of SecretClient. The constructor I use for secret client:new SecretClient(new Uri(keyVaultUrl), new ManagedIdentityCredential());
Example from my logs says that it can fail 3 times for 6 concurrent requests.Expected behavior
The method should not throw.
Actual behavior (include Exception or Stack Trace)
To Reproduce
Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)
Call GetSecret in parralel (for same resource) with KeyVaultTestClient singleton
Environment:
dotnet --info
output for .NET Core projects): e.g. Azure AppService .NET Core 3.1 - I do not see the problem on my other app in Azure which is using .NET Framework 4.7.2The text was updated successfully, but these errors were encountered: