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

Cannot list all VMs in ResourceGroup due to InvalidApiVersion in Compute #10589

Closed
clarkbreyman-yammer opened this issue Mar 31, 2020 · 2 comments

Comments

@clarkbreyman-yammer
Copy link

  • Package Name: azure-mgmt-compute
  • Package Version: 12.0.0
  • Operating System: MacOS 10.15.3
  • Python Version: 3.5.9

Describe the bug
Using the default api version, I get a response back indicating the api version is not supported. See below for stack trace.

To Reproduce
Steps to reproduce the behavior:

  1. List virtual machines in resource group

Expected behavior
Return list of virtual machines

Screenshots
N/A

Additional context
Stack trace:
Traceback (most recent call last):
File "", line 2, in
File "", line 4, in each_group
File "", line 5, in
File "", line 4, in each_group_vm
File "/Users/cbreym/dev/scratch/capacity/venv/lib/python3.5/site-packages/msrest/paging.py", line 143, in next
self.advance_page()
File "/Users/cbreym/dev/scratch/capacity/venv/lib/python3.5/site-packages/msrest/paging.py", line 129, in advance_page
self._response = self._get_next(self.next_link)
File "/Users/cbreym/dev/scratch/capacity/venv/lib/python3.5/site-packages/azure/mgmt/compute/v2019_12_01/operations/_virtual_machines_operations.py", line 916, in internal_paging
raise exp
msrestazure.azure_exceptions.CloudError: Azure Error: InvalidApiVersionParameter
Message: The api-version '2019-12-01' is invalid. The supported versions are '2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'.

@clarkbreyman-yammer
Copy link
Author

clarkbreyman-yammer commented Apr 1, 2020

More compact sample:

from azure.common.client_factory import get_client_from_cli_profile
from azure.mgmt.monitor import MonitorManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.resource import ResourceManagementClient


def test():
    monitoring_client = get_client_from_cli_profile(MonitorManagementClient)
    compute_client = get_client_from_cli_profile(ComputeManagementClient)
    resource_client = get_client_from_cli_profile(ResourceManagementClient)
    for g in resource_client.resource_groups.list():
        for v in compute_client.virtual_machines.list(resource_group_name=g.name):
            print([g,v])

packages:

(venv) bash-3.2$ pip3 list
Package                Version
---------------------- ----------
adal                   1.2.2
antlr4-python3-runtime 4.8
applicationinsights    0.11.9
argcomplete            1.11.1
azure-cli-core         2.3.0
azure-cli-nspkg        3.0.4
azure-cli-telemetry    1.0.4
azure-common           1.1.25
azure-mgmt-compute     12.0.0
azure-mgmt-monitor     0.8.0
azure-mgmt-resource    8.0.1
azure-nspkg            3.0.2
bcrypt                 3.1.7
certifi                2019.11.28
cffi                   1.14.0
chardet                3.0.4
colorama               0.4.3
cryptography           2.8
humanfriendly          8.1
idna                   2.9
importlib-metadata     1.6.0
isodate                0.6.0
jmespath               0.9.5
knack                  0.7.0rc1
msrest                 0.6.11
msrestazure            0.6.3
oauthlib               3.1.0
paramiko               2.7.1
pip                    20.0.2
pkginfo                1.5.0.1
portalocker            1.6.0
pycparser              2.20
Pygments               2.6.1
PyJWT                  1.7.1
PyNaCl                 1.3.0
pyOpenSSL              19.1.0
python-dateutil        2.8.1
PyYAML                 5.3.1
requests               2.23.0
requests-oauthlib      1.3.0
setuptools             45.2.0
six                    1.14.0
tabulate               0.8.7
urllib3                1.25.8
wheel                  0.30.0
zipp                   1.2.0

@clarkbreyman-yammer clarkbreyman-yammer changed the title Service reporting compute v2019_12_01 as invalid Cannot list all VMs in ResourceGroup due to InvalidApiVersion in Compute Apr 1, 2020
@clarkbreyman-yammer
Copy link
Author

Not a bug - was using ResourceGroup and not name is resource_Group_name parameter.

openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this issue Nov 13, 2020
@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
None yet
Projects
None yet
Development

No branches or pull requests

1 participant