Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ interactions:
User-Agent:
- AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2024-11-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2025-04-01
response:
body:
string: "{\r\n \"name\": \"vmss1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ interactions:
User-Agent:
- AZURECLI/2.60.0 azsdk-python-core/1.30.1 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_fixed000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2024-11-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_fixed000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2025-04-01
response:
body:
string: "{\r\n \"name\": \"vmss1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_fixed000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ interactions:
User-Agent:
- AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_predictive_policy000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2024-11-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_predictive_policy000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2025-04-01
response:
body:
string: "{\r\n \"name\": \"vmss1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_predictive_policy000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ interactions:
User-Agent:
- AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_recurring000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2024-11-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_recurring000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2025-04-01
response:
body:
string: "{\r\n \"name\": \"vmss1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_recurring000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ interactions:
User-Agent:
- AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_refine000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2024-11-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_refine000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2025-04-01
response:
body:
string: "{\r\n \"name\": \"vmss1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_refine000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ interactions:
User-Agent:
- AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_rule_with_dimensions000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2024-11-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_rule_with_dimensions000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2025-04-01
response:
body:
string: "{\r\n \"name\": \"vmss1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_rule_with_dimensions000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ interactions:
User-Agent:
- AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_rules000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2024-11-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_rules000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2025-04-01
response:
body:
string: "{\r\n \"name\": \"vmss1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_rules000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1\"\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ interactions:
User-Agent:
- AZURECLI/2.63.0 azsdk-python-core/1.28.0 Python/3.10.11 (Windows-10-10.0.22631-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_show_predictive_metric000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2024-11-01
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_show_predictive_metric000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1?api-version=2025-04-01
response:
body:
string: "{\r\n \"name\": \"vmss1\",\r\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_monitor_autoscale_show_predictive_metric000001/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1\"\
Expand Down
22 changes: 0 additions & 22 deletions src/azure-cli/azure/cli/command_modules/vm/_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,28 +317,6 @@ def _create_image_instance(publisher, offer, sku, version):
}


def _get_latest_image_version(cli_ctx, location, publisher, offer, sku, edge_zone=None):
from azure.cli.core.azclierror import InvalidArgumentValueError
if edge_zone is not None:
from azure.cli.core.commands.client_factory import get_mgmt_service_client
from azure.cli.core.profiles import ResourceType
edge_zone_client = get_mgmt_service_client(cli_ctx, ResourceType.MGMT_COMPUTE).virtual_machine_images_edge_zone
top_one = edge_zone_client.list(location, edge_zone, publisher, offer, sku, top=1, orderby='name desc')
if not top_one:
raise InvalidArgumentValueError("Can't resolve the version of '{}:{}:{}:{}'"
.format(publisher, offer, sku, edge_zone))
else:
top_one = _compute_client_factory(cli_ctx).virtual_machine_images.list(location,
publisher,
offer,
sku,
top=1,
orderby='name desc')
if not top_one:
raise InvalidArgumentValueError("Can't resolve the version of '{}:{}:{}'".format(publisher, offer, sku))
return top_one[0].name


def _get_latest_image_version_by_aaz(cli_ctx, location, publisher, offer, sku, edge_zone=None):
from azure.cli.core.azclierror import InvalidArgumentValueError
if edge_zone is not None:
Expand Down
4 changes: 2 additions & 2 deletions src/azure-cli/azure/cli/command_modules/vm/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
validate_asg_names_or_ids, validate_keyvault, _validate_proximity_placement_group,
validate_vm_name_for_monitor_metrics)

from azure.cli.command_modules.vm._vm_utils import MSI_LOCAL_ID
from azure.cli.command_modules.vm._vm_utils import MSI_LOCAL_ID, UpgradeMode
from azure.cli.command_modules.vm._image_builder import ScriptType

from azure.cli.command_modules.monitor.validators import validate_metric_dimension
Expand All @@ -38,7 +38,7 @@ def load_arguments(self, _):
# Model imports
DiskStorageAccountTypes = self.get_models('DiskStorageAccountTypes', operation_group='disks')
SnapshotStorageAccountTypes = self.get_models('SnapshotStorageAccountTypes', operation_group='snapshots')
UpgradeMode, CachingTypes, OperatingSystemTypes = self.get_models('UpgradeMode', 'CachingTypes', 'OperatingSystemTypes')
CachingTypes, OperatingSystemTypes = self.get_models('CachingTypes', 'OperatingSystemTypes')
HyperVGenerationTypes = self.get_models('HyperVGenerationTypes')
DedicatedHostLicenseTypes = self.get_models('DedicatedHostLicenseTypes')
ReplicationMode = self.get_models('ReplicationMode', operation_group='gallery_image_versions')
Expand Down
11 changes: 7 additions & 4 deletions src/azure-cli/azure/cli/command_modules/vm/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ def load_command_table(self, _):
g.generic_update_command('update')

with self.command_group('vmss') as g:
g.custom_command('create', 'create_vmss',
transform=DeploymentOutputLongRunningOperation(self.cli_ctx, 'Starting vmss create'),
supports_no_wait=True, table_transformer=deployment_validate_table_format,
validator=process_vmss_create_namespace, exception_handler=handle_template_based_exception)
g.custom_show_command('show', 'get_vmss_by_aaz', table_transformer=get_vmss_table_output_transformer(self, False))
g.generic_update_command('update', getter_name='get_vmss_modified_by_aaz', setter_name='update_vmss', supports_no_wait=True, command_type=compute_custom, validator=validate_vmss_update_namespace)
g.wait_command('wait', getter_name='get_vmss_by_aaz', getter_type=compute_custom)
g.custom_command('identity assign', 'assign_vmss_identity', validator=process_assign_identity_namespace)
g.custom_command('identity remove', 'remove_vmss_identity', validator=process_remove_identity_namespace, is_preview=True)
g.custom_show_command('identity show', 'show_vmss_identity')
Expand All @@ -412,12 +419,8 @@ def load_command_table(self, _):
g.custom_command('list', 'list_vmss_applications')

with self.command_group('vmss', compute_vmss_sdk, operation_group='virtual_machine_scale_sets') as g:
g.custom_command('create', 'create_vmss', transform=DeploymentOutputLongRunningOperation(self.cli_ctx, 'Starting vmss create'), supports_no_wait=True, table_transformer=deployment_validate_table_format, validator=process_vmss_create_namespace, exception_handler=handle_template_based_exception)
g.custom_command('get-instance-view', 'get_vmss_instance_view', table_transformer='{ProvisioningState:statuses[0].displayStatus, PowerState:statuses[1].displayStatus}')
g.custom_show_command('show', 'get_vmss', table_transformer=get_vmss_table_output_transformer(self, False))
g.generic_update_command('update', getter_name='get_vmss_modified_by_aaz', setter_name='update_vmss', supports_no_wait=True, command_type=compute_custom, validator=validate_vmss_update_namespace)
g.custom_command('update-instances', 'update_vmss_instances', supports_no_wait=True)
g.wait_command('wait', getter_name='get_vmss', getter_type=compute_custom)

from .aaz.latest.vmss import List as VMSSList
self.command_table['vmss list'] = VMSSList(loader=self,
Expand Down
Loading