Skip to content

get_client_from_auth_file returns Unauthorized with KeyVaultClient #5710

Description

@kottofy

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.

Metadata

Metadata

Assignees

Labels

MgmtThis issue is related to a management-plane library.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions