Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/azure-cli/azure/cli/command_modules/vm/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,7 @@ def load_arguments(self, _):
c.argument('wire_server_access_control_profile_reference_id', options_list=['--wire-server-access-control-profile-reference-id', '--wire-server-profile-id'], min_api='2024-11-01', help='Specify the access control profile version resource id of wire server.')
c.argument('imds_mode', arg_type=get_enum_type(self.get_models('Mode')), min_api='2024-11-01', help='Specify the mode that proxy agent will execute on if the feature is enabled.')
c.argument('imds_access_control_profile_reference_id', options_list=['--imds-access-control-profile-reference-id', '--imds-profile-id'], min_api='2024-11-01', help='Specify the access control profile version resource id resource id of imds.')
c.argument('add_proxy_agent_extension', options_list=['--add-proxy-agent-extension', '--add-proxy-agent-ext'], arg_type=get_three_state_flag(), help="Specify whether to implicitly install the ProxyAgent Extension. This option is currently applicable only for Linux OS. Use with --enable-proxy-agent.")

with self.argument_context('vm update') as c:
c.argument('license_type', license_type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def build_vm_resource( # pylint: disable=too-many-locals, too-many-statements,
enable_user_reboot_scheduled_events=None, enable_user_redeploy_scheduled_events=None,
zone_placement_policy=None, include_zones=None, exclude_zones=None, align_regional_disks_to_vm_zone=None,
wire_server_mode=None, imds_mode=None, wire_server_access_control_profile_reference_id=None,
imds_access_control_profile_reference_id=None, key_incarnation_id=None):
imds_access_control_profile_reference_id=None, key_incarnation_id=None, add_proxy_agent_extension=None):

os_caching = disk_info['os'].get('caching')

Expand Down Expand Up @@ -695,6 +695,9 @@ def _build_storage_profile():
if imds:
proxy_agent_settings['imds'] = imds

if add_proxy_agent_extension is not None:
proxy_agent_settings['addProxyAgentExtension'] = add_proxy_agent_extension

if proxy_agent_settings:
vm_properties['securityProfile']['proxyAgentSettings'] = proxy_agent_settings

Expand Down Expand Up @@ -1042,7 +1045,8 @@ def build_vmss_resource(cmd, name, computer_name_prefix, location, tags, overpro
enable_user_redeploy_scheduled_events=None, skuprofile_vmsizes=None,
skuprofile_allostrat=None, skuprofile_rank=None,
security_posture_reference_is_overridable=None, zone_balance=None, wire_server_mode=None,
imds_mode=None, wire_server_access_control_profile_reference_id=None,
imds_mode=None, add_proxy_agent_extension=None,
wire_server_access_control_profile_reference_id=None,
imds_access_control_profile_reference_id=None, enable_automatic_zone_balancing=None,
automatic_zone_balancing_strategy=None, automatic_zone_balancing_behavior=None,
enable_automatic_repairs=None):
Expand Down Expand Up @@ -1598,6 +1602,9 @@ def build_vmss_resource(cmd, name, computer_name_prefix, location, tags, overpro
if imds:
proxy_agent_settings['imds'] = imds

if add_proxy_agent_extension is not None:
proxy_agent_settings['addProxyAgentExtension'] = add_proxy_agent_extension

if proxy_agent_settings:
security_profile['proxyAgentSettings'] = proxy_agent_settings

Expand Down
205 changes: 177 additions & 28 deletions src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_update.py

Large diffs are not rendered by default.

1,254 changes: 980 additions & 274 deletions src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vmss/_update.py

Large diffs are not rendered by default.

50 changes: 44 additions & 6 deletions src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

from .aaz.latest.vm.disk import AttachDetachDataDisk
from .aaz.latest.vm import Update as UpdateVM
from .aaz.latest.vmss import Update as UpdateVMSS

from .generated.custom import * # noqa: F403, pylint: disable=unused-wildcard-import,wildcard-import
try:
Expand Down Expand Up @@ -873,7 +874,7 @@ def create_vm(cmd, vm_name, resource_group_name, image=None, size='Standard_DS1_
enable_user_redeploy_scheduled_events=None, zone_placement_policy=None, include_zones=None,
exclude_zones=None, align_regional_disks_to_vm_zone=None, wire_server_mode=None, imds_mode=None,
wire_server_access_control_profile_reference_id=None, imds_access_control_profile_reference_id=None,
key_incarnation_id=None):
key_incarnation_id=None, add_proxy_agent_extension=None):

from azure.cli.core.commands.client_factory import get_subscription_id
from azure.cli.core.util import random_string, hash_string
Expand Down Expand Up @@ -1103,7 +1104,7 @@ def create_vm(cmd, vm_name, resource_group_name, image=None, size='Standard_DS1_
imds_mode=imds_mode,
wire_server_access_control_profile_reference_id=wire_server_access_control_profile_reference_id,
imds_access_control_profile_reference_id=imds_access_control_profile_reference_id,
key_incarnation_id=key_incarnation_id)
key_incarnation_id=key_incarnation_id, add_proxy_agent_extension=add_proxy_agent_extension)

vm_resource['dependsOn'] = vm_dependencies

Expand Down Expand Up @@ -1649,6 +1650,7 @@ def update_vm(cmd, resource_group_name, vm_name, os_disk=None, disk_caching=None
security_type=None, enable_proxy_agent=None, proxy_agent_mode=None, additional_scheduled_events=None,
enable_user_reboot_scheduled_events=None, enable_user_redeploy_scheduled_events=None,
align_regional_disks_to_vm_zone=None, wire_server_mode=None, imds_mode=None,
add_proxy_agent_extension=None,
wire_server_access_control_profile_reference_id=None, imds_access_control_profile_reference_id=None,
key_incarnation_id=None, **kwargs):
from azure.mgmt.core.tools import parse_resource_id, resource_id, is_valid_resource_id
Expand Down Expand Up @@ -1680,6 +1682,21 @@ def _output(self, *args, **kwargs):
}))
vm = get_vm_to_update(cmd, resource_group_name, vm_name)

if add_proxy_agent_extension is not None:
args = {
Comment on lines +1685 to +1686
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Empty line after the if statement reduces code readability. Remove the blank line after line 1685.

Copilot uses AI. Check for mistakes.
'resource_group': resource_group_name,
'vm_name': vm_name,
'no_wait': no_wait,
'security_profile': {
'proxy_agent_settings': {
'add_proxy_agent_extension': add_proxy_agent_extension
}
}
}

LongRunningOperation(cmd.cli_ctx)(UpdateVM(cli_ctx=cmd.cli_ctx)(command_args=args))
vm = get_vm_to_update(cmd, resource_group_name, vm_name)

disk_name = None
if os_disk is not None:
if is_valid_resource_id(os_disk):
Expand Down Expand Up @@ -1897,7 +1914,8 @@ def _output(self, *args, **kwargs):
}
client = _compute_client_factory(cmd.cli_ctx, aux_subscriptions=aux_subscriptions)
if wire_server_access_control_profile_reference_id is not None or \
imds_access_control_profile_reference_id is not None:
imds_access_control_profile_reference_id is not None or \
add_proxy_agent_extension is not None:
kwargs['parameters'] = vm
return sdk_no_wait(no_wait, client.virtual_machines.begin_create_or_update, resource_group_name, vm_name, **kwargs)
# endregion
Expand Down Expand Up @@ -3407,7 +3425,7 @@ def create_vmss(cmd, vmss_name, resource_group_name, image=None,
enable_user_redeploy_scheduled_events=None, skuprofile_vmsizes=None,
skuprofile_allostrat=None, skuprofile_rank=None,
security_posture_reference_is_overridable=None, zone_balance=None, wire_server_mode=None,
imds_mode=None, wire_server_access_control_profile_reference_id=None,
imds_mode=None, add_proxy_agent_extension=None, wire_server_access_control_profile_reference_id=None,
imds_access_control_profile_reference_id=None, enable_automatic_zone_balancing=None,
automatic_zone_balancing_strategy=None, automatic_zone_balancing_behavior=None,
enable_automatic_repairs=None):
Expand Down Expand Up @@ -3728,6 +3746,7 @@ def _get_public_ip_address_allocation(value, sku):
skuprofile_rank=skuprofile_rank,
security_posture_reference_is_overridable=security_posture_reference_is_overridable,
zone_balance=zone_balance, wire_server_mode=wire_server_mode, imds_mode=imds_mode,
add_proxy_agent_extension=add_proxy_agent_extension,
wire_server_access_control_profile_reference_id=wire_server_access_control_profile_reference_id,
imds_access_control_profile_reference_id=imds_access_control_profile_reference_id,
enable_automatic_zone_balancing=enable_automatic_zone_balancing,
Expand Down Expand Up @@ -4166,7 +4185,8 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
upgrade_policy_mode=None, enable_auto_os_upgrade=None, skuprofile_vmsizes=None,
skuprofile_allostrat=None, skuprofile_rank=None,
security_posture_reference_is_overridable=None, zone_balance=None,
wire_server_mode=None, imds_mode=None, wire_server_access_control_profile_reference_id=None,
wire_server_mode=None, imds_mode=None, add_proxy_agent_extension=None,
wire_server_access_control_profile_reference_id=None,
imds_access_control_profile_reference_id=None, enable_automatic_zone_balancing=None,
automatic_zone_balancing_strategy=None, automatic_zone_balancing_behavior=None, **kwargs):
vmss = kwargs['parameters']
Expand Down Expand Up @@ -4197,6 +4217,23 @@ def _output(self, *args, **kwargs):
}))
vmss = get_vmss_modified(cmd, resource_group_name, name, instance_id, security_type)

if add_proxy_agent_extension is not None:
args = {
'resource_group': resource_group_name,
'vm_scale_set_name': name,
'no_wait': no_wait,
'virtual_machine_profile': {
'security_profile': {
'proxy_agent_settings': {
'add_proxy_agent_extension': add_proxy_agent_extension
}
}
}
}

LongRunningOperation(cmd.cli_ctx)(UpdateVMSS(cli_ctx=cmd.cli_ctx)(command_args=args))
vmss = get_vmss_modified(cmd, resource_group_name, name, instance_id, security_type)

aux_subscriptions = None
# pylint: disable=too-many-boolean-expressions
if vmss and hasattr(vmss, 'virtual_machine_profile') and vmss.virtual_machine_profile and \
Expand Down Expand Up @@ -4542,7 +4579,8 @@ def _output(self, *args, **kwargs):
vmss.zone_balance = zone_balance

if wire_server_access_control_profile_reference_id is not None or \
imds_access_control_profile_reference_id is not None:
imds_access_control_profile_reference_id is not None or \
add_proxy_agent_extension is not None:
kwargs['parameters'] = vmss

return sdk_no_wait(no_wait, client.virtual_machine_scale_sets.begin_create_or_update,
Expand Down
Loading