-
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] Class KeyVaultCredential does not reflect change in www-authenticate header #5702
Comments
Thank you for opening this issue! We are routing it to the appropriate team for follow up. CC: @schaabs |
@msfcolombo can you tell me more about the scenario you are seeing this in? We are trying to figure out how common this scenario is. |
It happens when the subscription administrator moves the key vault (or the parent subscription) from one tenant to another. The detailed scenario is as follows:
It's uncommon because moving a vault from a tenant to another is uncommon. But when it happens, it appears that the service is facing an outage similar to expired credentials. Rebooting the machine or restarting the process fixes, because it throws away the cache. |
This issue has been addressed and this fix has been published in v3.0.4 (https://www.nuget.org/packages/Microsoft.Azure.KeyVault/3.0.4). This fix updates the challenge class whenever it receives a 401 response with the WWW-Authenticate header. The resulting behavior when a vault is migrated from one tenant to another is that the first call to the KeyVaultClient after the migration will still call the authentication callback with the original authority, and so that call will still fail with a 401 and the user would have to handle the exception. However subsequent calls to the KeyVaultClient will pass the correct authority to the authentication callback. |
If the customer moves a key vault from one tenant to another, the
www-authenticate
header changes, but theKeyVaultCredential
class does not detect the new value and use the previous forever. The process keeps requesting tokens for the wrong tenant and becomes unable to access that specific key vault again.This caused an incident that required rebooting of servers in the cloud.
The bug is related to this code (link):
The proposed fix is when the request fails with 401 down the pipeline, the
PostAuthenticate
method is called with the response, allowing the challenge cache to be updated.The text was updated successfully, but these errors were encountered: