@@ -1633,6 +1633,30 @@ def update_vm(cmd, resource_group_name, vm_name, os_disk=None, disk_caching=None
16331633 SecurityProfile , UefiSettings = cmd .get_models ('SecurityProfile' , 'UefiSettings' )
16341634 vm = kwargs ['parameters' ]
16351635
1636+ if wire_server_access_control_profile_reference_id is not None or \
1637+ imds_access_control_profile_reference_id is not None :
1638+ from .aaz .latest .vm import Patch as VMPatchUpdate
1639+
1640+ class VMUpdateReferenceId (VMPatchUpdate ):
1641+ def _output (self , * args , ** kwargs ):
1642+ result = self .deserialize_output (self .ctx .vars .instance , client_flatten = False )
1643+ return result
1644+
1645+ security_profile = {'proxy_agent_settings' : {}}
1646+ if wire_server_access_control_profile_reference_id :
1647+ security_profile ['proxy_agent_settings' ]['wire_server' ] = {
1648+ 'in_vm_access_control_profile_reference_id' : wire_server_access_control_profile_reference_id }
1649+ if imds_access_control_profile_reference_id :
1650+ security_profile ['proxy_agent_settings' ]['imds' ] = {
1651+ 'in_vm_access_control_profile_reference_id' : imds_access_control_profile_reference_id }
1652+
1653+ LongRunningOperation (cmd .cli_ctx )(VMUpdateReferenceId (cli_ctx = cmd .cli_ctx )(command_args = {
1654+ 'vm_name' : vm_name ,
1655+ 'resource_group' : resource_group_name ,
1656+ 'security_profile' : security_profile
1657+ }))
1658+ vm = get_vm_to_update (cmd , resource_group_name , vm_name )
1659+
16361660 disk_name = None
16371661 if os_disk is not None :
16381662 if is_valid_resource_id (os_disk ):
@@ -1750,10 +1774,7 @@ def update_vm(cmd, resource_group_name, vm_name, os_disk=None, disk_caching=None
17501774 vm .security_profile .uefi_settings = UefiSettings (secure_boot_enabled = enable_secure_boot ,
17511775 v_tpm_enabled = enable_vtpm )
17521776
1753- proxy_agent_parameters = [
1754- enable_proxy_agent , wire_server_mode , imds_mode , key_incarnation_id ,
1755- wire_server_access_control_profile_reference_id , imds_access_control_profile_reference_id
1756- ]
1777+ proxy_agent_parameters = [enable_proxy_agent , wire_server_mode , imds_mode , key_incarnation_id ]
17571778 if any (parameter is not None for parameter in proxy_agent_parameters ):
17581779 ProxyAgentSettings = cmd .get_models ('ProxyAgentSettings' )
17591780 HostEndpointSettings = cmd .get_models ('HostEndpointSettings' )
@@ -1776,14 +1797,8 @@ def update_vm(cmd, resource_group_name, vm_name, os_disk=None, disk_caching=None
17761797 vm .security_profile .proxy_agent_settings .key_incarnation_id = key_incarnation_id
17771798 if wire_server_mode is not None :
17781799 vm .security_profile .proxy_agent_settings .wire_server .mode = wire_server_mode
1779- if wire_server_access_control_profile_reference_id is not None :
1780- vm .security_profile .proxy_agent_settings .wire_server .in_vm_access_control_profile_reference_id = \
1781- wire_server_access_control_profile_reference_id
17821800 if imds_mode is not None :
17831801 vm .security_profile .proxy_agent_settings .imds .mode = imds_mode
1784- if imds_access_control_profile_reference_id is not None :
1785- vm .security_profile .proxy_agent_settings .imds .in_vm_access_control_profile_reference_id = \
1786- imds_access_control_profile_reference_id
17871802
17881803 if workspace is not None :
17891804 workspace_id = _prepare_workspace (cmd , resource_group_name , workspace )
@@ -1858,6 +1873,9 @@ def update_vm(cmd, resource_group_name, vm_name, os_disk=None, disk_caching=None
18581873 "automaticallyApprove" : enable_user_reboot_scheduled_events
18591874 }
18601875 client = _compute_client_factory (cmd .cli_ctx , aux_subscriptions = aux_subscriptions )
1876+ if wire_server_access_control_profile_reference_id is not None or \
1877+ imds_access_control_profile_reference_id is not None :
1878+ kwargs ['parameters' ] = vm
18611879 return sdk_no_wait (no_wait , client .virtual_machines .begin_create_or_update , resource_group_name , vm_name , ** kwargs )
18621880# endregion
18631881
@@ -4112,6 +4130,33 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
41124130 imds_access_control_profile_reference_id = None , enable_automatic_zone_balancing = None ,
41134131 automatic_zone_balancing_strategy = None , automatic_zone_balancing_behavior = None , ** kwargs ):
41144132 vmss = kwargs ['parameters' ]
4133+
4134+ if wire_server_access_control_profile_reference_id is not None or \
4135+ imds_access_control_profile_reference_id is not None :
4136+ from .aaz .latest .vmss import Patch as VMSSPatchUpdate
4137+
4138+ class VMSSUpdateReferenceId (VMSSPatchUpdate ):
4139+ def _output (self , * args , ** kwargs ):
4140+ result = self .deserialize_output (self .ctx .vars .instance , client_flatten = False )
4141+ return result
4142+
4143+ security_profile = {'proxy_agent_settings' : {}}
4144+ if wire_server_access_control_profile_reference_id :
4145+ security_profile ['proxy_agent_settings' ]['wire_server' ] = {
4146+ 'in_vm_access_control_profile_reference_id' : wire_server_access_control_profile_reference_id }
4147+ if imds_access_control_profile_reference_id :
4148+ security_profile ['proxy_agent_settings' ]['imds' ] = {
4149+ 'in_vm_access_control_profile_reference_id' : imds_access_control_profile_reference_id }
4150+
4151+ LongRunningOperation (cmd .cli_ctx )(VMSSUpdateReferenceId (cli_ctx = cmd .cli_ctx )(command_args = {
4152+ 'vm_scale_set_name' : name ,
4153+ 'resource_group' : resource_group_name ,
4154+ 'virtual_machine_profile' : {
4155+ 'security_profile' : security_profile
4156+ }
4157+ }))
4158+ vmss = get_vmss_modified (cmd , resource_group_name , name , instance_id , security_type )
4159+
41154160 aux_subscriptions = None
41164161 # pylint: disable=too-many-boolean-expressions
41174162 if vmss and hasattr (vmss , 'virtual_machine_profile' ) and vmss .virtual_machine_profile and \
@@ -4273,9 +4318,7 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
42734318 'vTpmEnabled' : enable_vtpm
42744319 }}
42754320
4276- if enable_proxy_agent is not None or wire_server_mode is not None or imds_mode is not None or \
4277- wire_server_access_control_profile_reference_id is not None or \
4278- imds_access_control_profile_reference_id is not None :
4321+ if enable_proxy_agent is not None or wire_server_mode is not None or imds_mode is not None :
42794322 SecurityProfile = cmd .get_models ('SecurityProfile' )
42804323 ProxyAgentSettings = cmd .get_models ('ProxyAgentSettings' )
42814324 HostEndpointSettings = cmd .get_models ('HostEndpointSettings' )
@@ -4298,14 +4341,8 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
42984341 vmss .virtual_machine_profile .security_profile .proxy_agent_settings .enabled = enable_proxy_agent
42994342 if wire_server_mode is not None :
43004343 vmss .virtual_machine_profile .security_profile .proxy_agent_settings .wire_server .mode = wire_server_mode
4301- if wire_server_access_control_profile_reference_id is not None :
4302- vmss .virtual_machine_profile .security_profile .proxy_agent_settings .wire_server . \
4303- in_vm_access_control_profile_reference_id = wire_server_access_control_profile_reference_id
43044344 if imds_mode is not None :
43054345 vmss .virtual_machine_profile .security_profile .proxy_agent_settings .imds .mode = imds_mode
4306- if imds_access_control_profile_reference_id is not None :
4307- vmss .virtual_machine_profile .security_profile .proxy_agent_settings .imds . \
4308- in_vm_access_control_profile_reference_id = imds_access_control_profile_reference_id
43094346
43104347 if regular_priority_count is not None or regular_priority_percentage is not None :
43114348 if vmss .orchestration_mode != 'Flexible' :
@@ -4464,6 +4501,10 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
44644501 if zone_balance is not None :
44654502 vmss .zone_balance = zone_balance
44664503
4504+ if wire_server_access_control_profile_reference_id is not None or \
4505+ imds_access_control_profile_reference_id is not None :
4506+ kwargs ['parameters' ] = vmss
4507+
44674508 return sdk_no_wait (no_wait , client .virtual_machine_scale_sets .begin_create_or_update ,
44684509 resource_group_name , name , ** kwargs )
44694510
0 commit comments