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
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/vm/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ def load_arguments(self, _):
c.argument('v_cpus_available', type=int, min_api='2021-11-01', help='Specify the number of vCPUs available')
c.argument('v_cpus_per_core', type=int, min_api='2021-11-01', help='Specify the ratio of vCPU to physical core. Setting this property to 1 also means that hyper-threading is disabled.')
c.argument('disk_controller_type', disk_controller_type)
c.argument('enable_proxy_agent', arg_type=get_three_state_flag(), min_api='2023-09-01', help='Specify whether proxy agent feature should be enabled on the virtual machine or virtual machine scale set.')
c.argument('enable_proxy_agent', arg_type=get_three_state_flag(), min_api='2023-09-01', help='Specify whether metadata security protoco (proxy agent) feature should be enabled on the virtual machine or virtual machine scale set.')
c.argument('proxy_agent_mode', deprecate_info=c.deprecate(target='--proxy-agent-mode', redirect='--wire-server-mode'), arg_type=get_enum_type(self.get_models('Mode')), min_api='2023-09-01', help='Specify the mode that proxy agent will execute on if the feature is enabled.')
c.argument('wire_server_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('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.')
Expand Down
51 changes: 29 additions & 22 deletions src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1757,28 +1757,31 @@ def update_vm(cmd, resource_group_name, vm_name, os_disk=None, disk_caching=None
if any(parameter is not None for parameter in proxy_agent_parameters):
ProxyAgentSettings = cmd.get_models('ProxyAgentSettings')
HostEndpointSettings = cmd.get_models('HostEndpointSettings')
wire_server = HostEndpointSettings(
mode=wire_server_mode,
in_vm_access_control_profile_reference_id=wire_server_access_control_profile_reference_id
)
imds = HostEndpointSettings(
mode=imds_mode,
in_vm_access_control_profile_reference_id=imds_access_control_profile_reference_id
)
wire_server = HostEndpointSettings()
imds = HostEndpointSettings()
if vm.security_profile is None:
vm.security_profile = SecurityProfile()
vm.security_profile.proxy_agent_settings = ProxyAgentSettings(
enabled=enable_proxy_agent, key_incarnation_id=key_incarnation_id, wire_server=wire_server, imds=imds)
vm.security_profile.proxy_agent_settings = ProxyAgentSettings(wire_server=wire_server, imds=imds)
elif vm.security_profile.proxy_agent_settings is None:
vm.security_profile.proxy_agent_settings = ProxyAgentSettings(
enabled=enable_proxy_agent, key_incarnation_id=key_incarnation_id, wire_server=wire_server, imds=imds)
vm.security_profile.proxy_agent_settings = ProxyAgentSettings(wire_server=wire_server, imds=imds)
else:
if vm.security_profile.proxy_agent_settings.wire_server is None:
vm.security_profile.proxy_agent_settings.wire_server = wire_server
if vm.security_profile.proxy_agent_settings.imds is None:
vm.security_profile.proxy_agent_settings.imds = imds

if enable_proxy_agent is not None:
vm.security_profile.proxy_agent_settings.enabled = enable_proxy_agent
if key_incarnation_id is not None:
vm.security_profile.proxy_agent_settings.key_incarnation_id = key_incarnation_id
if wire_server_mode is not None:
vm.security_profile.proxy_agent_settings.wire_server.mode = wire_server_mode
if wire_server_access_control_profile_reference_id is not None:
vm.security_profile.proxy_agent_settings.wire_server.in_vm_access_control_profile_reference_id = \
wire_server_access_control_profile_reference_id
if imds_mode is not None:
vm.security_profile.proxy_agent_settings.imds.mode = imds_mode
if imds_access_control_profile_reference_id is not None:
vm.security_profile.proxy_agent_settings.imds.in_vm_access_control_profile_reference_id = \
imds_access_control_profile_reference_id

Expand Down Expand Up @@ -4222,27 +4225,31 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
SecurityProfile = cmd.get_models('SecurityProfile')
ProxyAgentSettings = cmd.get_models('ProxyAgentSettings')
HostEndpointSettings = cmd.get_models('HostEndpointSettings')
wire_server = HostEndpointSettings(
mode=wire_server_mode,
in_vm_access_control_profile_reference_id=wire_server_access_control_profile_reference_id
)
imds = HostEndpointSettings(
mode=imds_mode,
in_vm_access_control_profile_reference_id=imds_access_control_profile_reference_id
)
wire_server = HostEndpointSettings()
imds = HostEndpointSettings()
if vmss.virtual_machine_profile.security_profile is None:
vmss.virtual_machine_profile.security_profile = SecurityProfile()
vmss.virtual_machine_profile.security_profile.proxy_agent_settings = ProxyAgentSettings(
enabled=enable_proxy_agent, wire_server=wire_server, imds=imds)
wire_server=wire_server, imds=imds)
elif vmss.virtual_machine_profile.security_profile.proxy_agent_settings is None:
vmss.virtual_machine_profile.security_profile.proxy_agent_settings = ProxyAgentSettings(
enabled=enable_proxy_agent, wire_server=wire_server, imds=imds)
wire_server=wire_server, imds=imds)
else:
if vmss.virtual_machine_profile.security_profile.proxy_agent_settings.wire_server is None:
vmss.virtual_machine_profile.security_profile.proxy_agent_settings.wire_server = wire_server
if vmss.virtual_machine_profile.security_profile.proxy_agent_settings.imds is None:
vmss.virtual_machine_profile.security_profile.proxy_agent_settings.imds = imds

if enable_proxy_agent is not None:
vmss.virtual_machine_profile.security_profile.proxy_agent_settings.enabled = enable_proxy_agent
if wire_server_mode is not None:
vmss.virtual_machine_profile.security_profile.proxy_agent_settings.wire_server.mode = wire_server_mode
if wire_server_access_control_profile_reference_id is not None:
vmss.virtual_machine_profile.security_profile.proxy_agent_settings.wire_server. \
in_vm_access_control_profile_reference_id = wire_server_access_control_profile_reference_id
if imds_mode is not None:
vmss.virtual_machine_profile.security_profile.proxy_agent_settings.imds.mode = imds_mode
if imds_access_control_profile_reference_id is not None:
vmss.virtual_machine_profile.security_profile.proxy_agent_settings.imds. \
in_vm_access_control_profile_reference_id = imds_access_control_profile_reference_id

Expand Down
Loading
Loading