Azure / Azure/azure-cli

azure-cli 2.50.0 pins subscriptions to v2019_11_01

Open
#26,966 3 comments 1 reaction 2 assignees Claimed by @bebound View on GitHub
Account act-identity-squad act-platform-engineering-squad Auto-Assign Azure CLI Team customer-reported feature-request Packaging
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

Due to the very large size of installing the azure CLI in docker container we use the https://github.com/clumio-code/azure-sdk-trim tool save hundreds of MBs. This tool trims the older SDKs since in most case they are useless and just a waste of space for the end users.

### Related command

`az login`

### Errors

```++ az login --service-principal -u **** -p **** -t ****
ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: No module named 'azure.mgmt.resource.subscriptions.v2019_11_01'
Traceback (most recent call last):
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
result = cmd_copy(params)
^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
return self.handler(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/cli/command_modules/profile/custom.py", line 139, in login
subscriptions = profile.login(
^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/cli/core/_profile.py", line 174, in login
subscriptions = subscription_finder.find_using_specific_tenant(tenant, credential)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/cli/core/_profile.py", line 807, in find_using_specific_tenant
subscriptions = client.subscriptions.list()
^^^^^^^^^^^^^^^^^^^^
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/azure/mgmt/resource/subscriptions/_subscription_client.py", line 158, in subscriptions
from .v2019_11_01.operations import SubscriptionsOperations as OperationClass
ModuleNotFoundError: No module named 'azure.mgmt.resource.subscriptions.v2019_11_01'
```

### Issue script & Debug output

see above

### Expected behavior

The azure CLI should not depend on 4y old APIs and work with the latest APIs.

### Environment Summary

```
> az --version
azure-cli 2.50.0

core 2.50.0
telemetry 1.0.8

Dependencies:
msal 1.22.0
azure-mgmt-resource 23.1.0b2

Python location '/root/.pyenv/versions/3.11.4/bin/python3'
Extensions directory '/root/.azure/cliextensions'

Python (Darwin) 3.11.4 (main, Jun 27 2023, 17:18:33) [Clang 14.0.3 (clang-1403.0.22.14.1)]
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.