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

Unable to retrieve secrets from azure keyvault #24209

Closed
Praveen288g opened this issue Apr 27, 2022 · 12 comments
Closed

Unable to retrieve secrets from azure keyvault #24209

Praveen288g opened this issue Apr 27, 2022 · 12 comments
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. KeyVault needs-author-feedback Workflow: More information is needed from author to address the issue. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team 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

@Praveen288g
Copy link

In Azure VM , when executing our python application exe , which uses
ClientSecretCredential(tenant_id: str, client_id: str, client_secret: str, kwargs: Any) function to Authenticate and retrieve secret's value from Azure Key Vault and the VM doesn't have Client Certificate and Azure CLI.

We are getting the following error where credentials are not successfully authenticated and we get following response:

image

The below one is the code snippet we have used :

MicrosoftTeams-image

@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 Apr 27, 2022
@azure-sdk azure-sdk added Client This issue points to a problem in the data-plane of the library. KeyVault needs-team-triage Workflow: This issue needs the team to triage. labels Apr 27, 2022
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Apr 27, 2022
@mccoyp mccoyp added Azure.Identity and removed needs-team-triage Workflow: This issue needs the team to triage. labels Apr 27, 2022
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Apr 27, 2022
@mccoyp
Copy link
Member

mccoyp commented Apr 27, 2022

For more context: a similar application, written in C#, is able to successfully fetch a token in the same environment. For the Python application, the secret request successfully reaches Key Vault and we do get a response (the 401 challenge shown in the log screenshot). However, token requests are hanging and timing out repeatedly until there's eventually a connection error from a lack of a response. Since it's specifically the token request that's failing, this seems like an azure-identity-specific configuration issue.

@xiangyan99
Copy link
Member

To separate the question, could you try code:

cred = ClientSecretCredential('tenantid', 'clientid', 'client_pass')

token = cred.get_token("https://vault.azure.net/.default")

print(token)

And see if identity works?

@xiangyan99 xiangyan99 added the needs-author-feedback Workflow: More information is needed from author to address the issue. label Apr 27, 2022
@mccoyp
Copy link
Member

mccoyp commented Apr 28, 2022

Confirmed offline that this environment isn't using any proxy configuration. We unfortunately can't access logs for the C# application that successfully makes token requests.

@xiangyan99
Copy link
Member

Did they have a chance to try the code above? @mccoyp

@mccoyp
Copy link
Member

mccoyp commented Apr 28, 2022

@xiangyan99 not yet, but I bumped the suggestion in our chat. Some other folks who are digging into the networking think that the issue could be a firewall -- which would make sense based on what we're seeing, but would also raise the question of how the C# application doesn't have this issue

@Praveen288g
Copy link
Author

@mccoyp when we tried with DefaultAzureCredential() function we were able to successfully authenticate and get the AKV secret value successfully

@ghost ghost removed the needs-author-feedback Workflow: More information is needed from author to address the issue. label Apr 29, 2022
@xiangyan99
Copy link
Member

@Praveen288g Thanks for the update.

To make sure I understand correctly, you mean it failed when you used ClientSecretCredential but succeeded when you use DefaultAzureCredential?

This makes me think maybe other types of credentials worked? e.g. MSI?

@Praveen288g
Copy link
Author

Praveen288g commented Apr 29, 2022

Yep you are correct @xiangyan99 , it worked for other type of credential

@xiangyan99
Copy link
Member

Thanks for your confirmation.

So is your problem solved? Or it is required to use ClientSecretCredential?

@Praveen288g
Copy link
Author

@xiangyan99 yep , i need confirmation whether AzureDefaultCredential() is best method to use in SFTP server/Azure VM , want to make sure whether it could cause any problem in future

@xiangyan99
Copy link
Member

It should not cause problems if you use AzureDefaultCredential() in a production environment (means it is stable and will not change).

If you want to have a more deterministic behavior, you can use a specific type of credential rather than AzureDefaultCredential which is a chain of credentials.

@xiangyan99 xiangyan99 added the needs-author-feedback Workflow: More information is needed from author to address the issue. label May 3, 2022
@ghost ghost added the no-recent-activity There has been no recent activity on this issue. label May 11, 2022
@ghost
Copy link

ghost commented May 11, 2022

Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you!

@ghost ghost closed this as completed May 25, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
This issue was closed.
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. KeyVault needs-author-feedback Workflow: More information is needed from author to address the issue. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team 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

No branches or pull requests

4 participants