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

get_client_from_auth_file returns Unauthorized with KeyVaultClient #5710

Closed
kottofy opened this issue Jun 6, 2019 · 2 comments · Fixed by #5716
Closed

get_client_from_auth_file returns Unauthorized with KeyVaultClient #5710

kottofy opened this issue Jun 6, 2019 · 2 comments · Fixed by #5716
Assignees
Labels
Mgmt This issue is related to a management-plane library.

Comments

@kottofy
Copy link

kottofy commented Jun 6, 2019

What would be great to be able to do is:
kv_client= get_client_from_auth_file(KeyVaultClient)

This returns the error TypeError: __init__() got an unexpected keyword argument 'base_url' which makes sense.

So, here is a helper class and essentially what I'd like to do:

class KeyVaultClientHelper:
    def __init__(self, credentials, **kwargs):
        self._credentials = credentials

helper = get_client_from_auth_file(KeyVaultClientHelper)
client = KeyVaultClient(helper._credentials)
print(client.get_secret("http://my-vault-url...", "MY-KEY", '').value))

This is successful until it tries to get a secret and it returns Unauthorized.

However, I am successful in getting secrets using a ServicePrincipalCredential with the same auth file if I manually open the file and pull the data.

It looks like some work has been done for get_client_from_cli_profile to support a KeyVaultClient already, so I'm hoping this could be fixed/added for get_client_from_auth_file.

@lmazuel lmazuel added the Mgmt This issue is related to a management-plane library. label Jun 6, 2019
@triage-new-issues triage-new-issues bot removed the triage label Jun 6, 2019
@lmazuel lmazuel self-assigned this Jun 6, 2019
@lmazuel
Copy link
Member

lmazuel commented Jun 6, 2019

Looking at it, thanks for the report!

@lmazuel
Copy link
Member

lmazuel commented Jun 6, 2019

Fixed
https://pypi.org/project/azure-common/1.1.22/

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Mgmt This issue is related to a management-plane library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants