Skip to content
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] ManagedIdentityCredential authentication failed: Status: 410 (Gone) #28568

Closed
zhiweiv opened this issue May 6, 2022 · 12 comments · Fixed by #37012
Closed

[BUG] ManagedIdentityCredential authentication failed: Status: 410 (Gone) #28568

zhiweiv opened this issue May 6, 2022 · 12 comments · Fixed by #37012
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@zhiweiv
Copy link

zhiweiv commented May 6, 2022

Library name and version

Azure.Identity 1.6.0

Describe the bug

Sometimes managed identity authentication failed due to 410 error from IMDS.

Expected behavior

Per https://docs.microsoft.com/en-us/azure/virtual-machines/linux/instance-metadata-service?tabs=linux#frequently-asked-questions

Why am I getting the error 500 Internal Server Error or 410 Resource Gone?

Retry your request. For more information, see Transient fault handling. If the problem persists, create a support issue in the Azure portal for the VM.

410 is a retriable error, Azure.Identity should retry for better stability. I guess it is probably here:

private class ManagedIdentityResponseClassifier : ResponseClassifier
{
public override bool IsRetriableResponse(HttpMessage message)
{
return message.Response.Status switch
{
404 => true,
502 => false,
_ => base.IsRetriableResponse(message)
};
}
}

Environment

.net 6.0 console app in AKS Linux container

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels May 6, 2022
@azure-sdk azure-sdk added Azure.Identity Client This issue points to a problem in the data-plane of the library. needs-team-triage Workflow: This issue needs the team to triage. labels May 6, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label May 6, 2022
@jsquire jsquire added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-team-triage Workflow: This issue needs the team to triage. labels May 6, 2022
@jsquire
Copy link
Member

jsquire commented May 6, 2022

//cc: @christothes

@jsquire
Copy link
Member

jsquire commented May 6, 2022

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@SKUD201
Copy link

SKUD201 commented May 9, 2022

Hello,

We had the exact same issue in the same environment. Being on version 1.5.0, it triggerred an exception similar to #24158.

We will update to 1.6.0 in the meantime.
Thanks.

@semornas
Copy link

Hello,

We had the exact same issue in the same environment. Being on version 1.5.0, it triggerred an exception similar to #24158.

We will update to 1.6.0 in the meantime. Thanks.

Hi there,
Any news regarding this issue? We have a bug in our backlog that is blocked because of this :(
Any help would be appreciated!

@devlie
Copy link
Member

devlie commented May 31, 2023

@christothes is there any plan to fix this?

IMDS can return HTTP 410 by design and their documentation requires caller to retry up to 70 secs, but ManagedIdentityCredential does not retry even once. Worse, because we don't retrieve the token ourselves (Storage/Cosmos clients do that automatically), we can't really retry the error ourselves without polluting our business layer which has no business of knowing which auth is used.

@christothes christothes self-assigned this May 31, 2023
@christothes
Copy link
Member

Just out of curiosity - how often are you seeing failures due to this error code (410)? I would think that it's rare.

@christothes christothes added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Jun 5, 2023
@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jun 5, 2023
@github-actions
Copy link

github-actions bot commented Jun 5, 2023

Hi @zhiweiv. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

@devlie
Copy link
Member

devlie commented Jun 5, 2023

Just out of curiosity - how often are you seeing failures due to this error code (410)? I would think that it's rare.

@christothes, not super high rate, but enough to cause us troubles. It caused our services to have four sev3 incidents in the past 2 weeks alone.

@christothes
Copy link
Member

christothes commented Jun 5, 2023

Just out of curiosity - how often are you seeing failures due to this error code (410)? I would think that it's rare.

@christothes, not super high rate, but enough to cause us troubles. It caused our services to have four sev3 incidents in the past 2 weeks alone.

That's way more frequently than I would have guessed! We can add status 410 to the retry statuses, however we wouldn't want to extend the default retry timeout to accommodate the 70 second delay. The main reason being that in a local development scenario, we need the endpoint failure to fail fast.

There is a workaround, however. You could supply a custom retry policy to the credentialOptions and customize the behavior for your specific scenario. See these docs for details

@github-actions
Copy link

Hi @zhiweiv, 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!

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue. label Jul 13, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 28, 2023
@tjrobinson
Copy link

@christothes Thanks for getting this change in. Do you know if there's a target date/release for this yet?

@christothes
Copy link
Member

It should be released on the next monthly release, which is early next month.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-author-feedback Workflow: More information is needed from author to address the issue. no-recent-activity There has been no recent activity on this issue. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants