Azure-sdk-for-python: Support for get_client_from_cli_profile(keyClient)

Created on 2 Sep 2019  路  7Comments  路  Source: Azure/azure-sdk-for-python

is it possible to use get_client_from_cli_profile(keyClient) ?

In [4]: from azure.common.client_factory import get_client_from_cli_profile

In [5]: c = get_client_from_cli_profile(KeyClient)

TypeError Traceback (most recent call last)
in
----> 1 c = get_client_from_cli_profile(KeyClient)

~/miniconda3/envs/py37/lib/python3.7/site-packages/azure/common/client_factory.py in get_client_from_cli_profile(client_class, *kwargs)
98 parameters['tenant_id'] = tenant_id
99 parameters.update(kwargs)
--> 100 return _instantiate_client(client_class, *
parameters)
101
102

~/miniconda3/envs/py37/lib/python3.7/site-packages/azure/common/client_factory.py in _instantiate_client(client_class, kwargs)
33 elif sys.version_info < (3, 0) and isinstance(kwargs[key], unicode):
34 kwargs[key] = kwargs[key].encode('utf-8')
---> 35 return client_class(
kwargs)
36
37

TypeError: __init__() missing 2 required positional arguments: 'vault_url' and 'credential'

Client KeyVault customer-reported

All 7 comments

apologies, should have searched the issues, let me check on this https://github.com/Azure/azure-sdk-for-python/pull/3908

1.1.23 still has the same issue, can some please comment if I can use get_client_from_cli_profile ?
n [1]: from azure import common

In [2]: common.__version__
Out[2]: '1.1.23'

I am also having this problem. My code is:
secret_client = get_client_from_cli_profile(SecretClient, vault_url=vault.properties.vault_uri, subscription_id=subscription_id)

I'm able to specify vault_url= as a positional param for **kwargs, but if I specify credential=, I get the following error: https://gist.github.com/freeone3000/b701d5518a1a5a9c4d9f08882619ae73

There doesn't seem to be a way to work around this.

Same issue here:

from azure.common.client_factory import get_client_from_cli_profile
from azure.keyvault.secrets import SecretClient
key_vault_client = get_client_from_cli_profile(SecretClient)

Related to #8591

@lmazuel

Thanks for working with Microsoft on GitHub! Tell us how you feel about your experience using the reactions on this comment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lmazuel picture lmazuel  路  3Comments

Korijn picture Korijn  路  3Comments

jmlero picture jmlero  路  3Comments

vnimbalkar picture vnimbalkar  路  4Comments

Koppens picture Koppens  路  4Comments