-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
az feedbackauto-generates most of the information requested below, as of CLI version 2.0.62
Describe the bug
Part 1 of the issue:
When using the version of azure-common which is bundled into azure-cli we hit the following error when attempting to obtain a list of Subscriptions through the get_client_from_cli_profile(SubscriptionClient) function:
File ".azdev/azdev-env/lib/python3.8/site-packages/azure/common/client_factory.py", line 100, in get_client_from_cli_profile return _instantiate_client(client_class, **parameters) File "azdev/azdev-env/lib/python3.8/site-packages/azure/common/client_factory.py", line 35, in _instantiate_client return client_class(**kwargs) TypeError: __init__() missing 1 required positional argument: 'credential'
This seems to be due to the fact that a credential argument is expected in the azure.mgmt.resource class, when a credentials argument is being provided in the get_client_from_cli_profile() function in azure.common
Part 2 of the issue:
If we update our dependencies manually to ensure that azure-common, azure-mgmt-resource and azure-mgmt-resourcegraph are all version 1.1.27, 19.0.0 and 8.0.0 respectively, we can consume the credentials change to credential. However, when attempting to iterate over a list of Subscriptions obtained using the get_client_from_cli_profile(SubscriptionClient) function, the following error is thrown:
File "/.azdev/azdev-env/lib/python3.8/site-packages/azure/common/credentials.py", line 72, in get_token _, token, fulltoken = credentials._token_retriever() # pylint:disable=protected-access TypeError: _retrieve_token() missing 1 required positional argument: 'token_resource'
To Reproduce
Reproduce part 1:
azure-mgmt-resource and azure-mgmt-resourcegraph should be listed as azdev dependencies and the following code should be run:
subsList = [] subsDict = [] subsClient = get_client_from_cli_profile(SubscriptionClient)
Reproduce part 2:
azure-common azure-mgmt-resource and azure-mgmt-resourcegraph should be listed as azdev dependencies using versions 1.1.27, 19.0.0 and 8.0.0 respectively, and the following lines of code should be run:
`subsList = []
subsDict = []
subsClient = get_client_from_cli_profile(SubscriptionClient)
for sub in subsClient.subscriptions.list():
subsDict.append(sub.as_dict())`
Expected behavior
Part 1:
It is expected that a subscription client should be returned.
Part 2:
It is expected that each subscription should be added to the subsDict list object.
Environment summary
OS - Linux Mint
OS version - 20.1 (Ulyssa)
CLI version - 2.28.0
CLI Core version - 2.28.0
Installation method - azdev
azure-mgmt-resource version - 19.0.0
azure-mgmt-resourcegraph version - 8.0.0
Part 1 only:
azure-common version - 1.1.22
Part 2 only:
azure-common version - 1.1.27