@@ -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
@@ -4082,6 +4100,33 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
40824100 imds_access_control_profile_reference_id = None , enable_automatic_zone_balancing = None ,
40834101 automatic_zone_balancing_strategy = None , automatic_zone_balancing_behavior = None , ** kwargs ):
40844102 vmss = kwargs ['parameters' ]
4103+
4104+ if wire_server_access_control_profile_reference_id is not None or \
4105+ imds_access_control_profile_reference_id is not None :
4106+ from .aaz .latest .vmss import Patch as VMSSPatchUpdate
4107+
4108+ class VMSSUpdateReferenceId (VMSSPatchUpdate ):
4109+ def _output (self , * args , ** kwargs ):
4110+ result = self .deserialize_output (self .ctx .vars .instance , client_flatten = False )
4111+ return result
4112+
4113+ security_profile = {'proxy_agent_settings' : {}}
4114+ if wire_server_access_control_profile_reference_id :
4115+ security_profile ['proxy_agent_settings' ]['wire_server' ] = {
4116+ 'in_vm_access_control_profile_reference_id' : wire_server_access_control_profile_reference_id }
4117+ if imds_access_control_profile_reference_id :
4118+ security_profile ['proxy_agent_settings' ]['imds' ] = {
4119+ 'in_vm_access_control_profile_reference_id' : imds_access_control_profile_reference_id }
4120+
4121+ LongRunningOperation (cmd .cli_ctx )(VMSSUpdateReferenceId (cli_ctx = cmd .cli_ctx )(command_args = {
4122+ 'vm_scale_set_name' : name ,
4123+ 'resource_group' : resource_group_name ,
4124+ 'virtual_machine_profile' : {
4125+ 'security_profile' : security_profile
4126+ }
4127+ }))
4128+ vmss = get_vmss_modified (cmd , resource_group_name , name , instance_id , security_type )
4129+
40854130 aux_subscriptions = None
40864131 # pylint: disable=too-many-boolean-expressions
40874132 if vmss and hasattr (vmss , 'virtual_machine_profile' ) and vmss .virtual_machine_profile and \
@@ -4243,9 +4288,7 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
42434288 'vTpmEnabled' : enable_vtpm
42444289 }}
42454290
4246- if enable_proxy_agent is not None or wire_server_mode is not None or imds_mode is not None or \
4247- wire_server_access_control_profile_reference_id is not None or \
4248- imds_access_control_profile_reference_id is not None :
4291+ if enable_proxy_agent is not None or wire_server_mode is not None or imds_mode is not None :
42494292 SecurityProfile = cmd .get_models ('SecurityProfile' )
42504293 ProxyAgentSettings = cmd .get_models ('ProxyAgentSettings' )
42514294 HostEndpointSettings = cmd .get_models ('HostEndpointSettings' )
@@ -4268,14 +4311,8 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
42684311 vmss .virtual_machine_profile .security_profile .proxy_agent_settings .enabled = enable_proxy_agent
42694312 if wire_server_mode is not None :
42704313 vmss .virtual_machine_profile .security_profile .proxy_agent_settings .wire_server .mode = wire_server_mode
4271- if wire_server_access_control_profile_reference_id is not None :
4272- vmss .virtual_machine_profile .security_profile .proxy_agent_settings .wire_server . \
4273- in_vm_access_control_profile_reference_id = wire_server_access_control_profile_reference_id
42744314 if imds_mode is not None :
42754315 vmss .virtual_machine_profile .security_profile .proxy_agent_settings .imds .mode = imds_mode
4276- if imds_access_control_profile_reference_id is not None :
4277- vmss .virtual_machine_profile .security_profile .proxy_agent_settings .imds . \
4278- in_vm_access_control_profile_reference_id = imds_access_control_profile_reference_id
42794316
42804317 if regular_priority_count is not None or regular_priority_percentage is not None :
42814318 if vmss .orchestration_mode != 'Flexible' :
@@ -4434,6 +4471,10 @@ def update_vmss(cmd, resource_group_name, name, license_type=None, no_wait=False
44344471 if zone_balance is not None :
44354472 vmss .zone_balance = zone_balance
44364473
4474+ if wire_server_access_control_profile_reference_id is not None or \
4475+ imds_access_control_profile_reference_id is not None :
4476+ kwargs ['parameters' ] = vmss
4477+
44374478 return sdk_no_wait (no_wait , client .virtual_machine_scale_sets .begin_create_or_update ,
44384479 resource_group_name , name , ** kwargs )
44394480
0 commit comments