diff --git a/src/azure-cli-core/azure/cli/core/commands/arm.py b/src/azure-cli-core/azure/cli/core/commands/arm.py index 97e0adc06d3..0762f2b2a11 100644 --- a/src/azure-cli-core/azure/cli/core/commands/arm.py +++ b/src/azure-cli-core/azure/cli/core/commands/arm.py @@ -1164,11 +1164,11 @@ def get_arm_resource_by_id(cli_ctx, arm_id, api_version=None): from azure.cli.core.parser import IncorrectUsageError raise IncorrectUsageError('Resource type {} not found.'.format(resource_type_str)) try: - # if the service specifies, use the default API version - api_version = rt.default_api_version - except AttributeError: - # if the service doesn't specify, use the most recent non-preview API version unless there is only a - # single API version. API versions are returned by the service in a sorted list + # Use the most recent non-preview API version unless there is only a + # single API version. API versions are returned by the service in a sorted list. api_version = next((x for x in rt.api_versions if not x.endswith('preview')), rt.api_versions[0]) + except AttributeError: + err = "No API versions found for resource type '{}'." + raise CLIError(err.format(resource_type_str)) return client.resources.get_by_id(arm_id, api_version) diff --git a/src/azure-cli-core/setup.py b/src/azure-cli-core/setup.py index 3bfa6884b88..71d809246a2 100644 --- a/src/azure-cli-core/setup.py +++ b/src/azure-cli-core/setup.py @@ -67,7 +67,7 @@ 'requests~=2.22', 'six~=1.12', 'pkginfo>=1.5.0.1', - 'azure-mgmt-resource==10.1.0', + 'azure-mgmt-resource==10.2.0', 'azure-mgmt-core==1.2.0' ] diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index f758b7ba077..edc63018855 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -69,7 +69,7 @@ azure-mgmt-redhatopenshift==0.1.0 azure-mgmt-redis==7.0.0rc1 azure-mgmt-relay==0.1.0 azure-mgmt-reservations==0.6.0 -azure-mgmt-resource==10.1.0 +azure-mgmt-resource==10.2.0 azure-mgmt-search==2.1.0 azure-mgmt-security==0.4.1 azure-mgmt-servicebus==0.6.0 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index ca52e2c507e..cfa6a2c4d48 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -69,7 +69,7 @@ azure-mgmt-redhatopenshift==0.1.0 azure-mgmt-redis==7.0.0rc1 azure-mgmt-relay==0.1.0 azure-mgmt-reservations==0.6.0 -azure-mgmt-resource==10.1.0 +azure-mgmt-resource==10.2.0 azure-mgmt-search==2.1.0 azure-mgmt-security==0.4.1 azure-mgmt-servicebus==0.6.0 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index b39fdf2fba6..cf463227e92 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -69,7 +69,7 @@ azure-mgmt-redhatopenshift==0.1.0 azure-mgmt-redis==7.0.0rc1 azure-mgmt-relay==0.1.0 azure-mgmt-reservations==0.6.0 -azure-mgmt-resource==10.1.0 +azure-mgmt-resource==10.2.0 azure-mgmt-search==2.1.0 azure-mgmt-security==0.4.1 azure-mgmt-servicebus==0.6.0