code: def remove_sqlvm_from_aglistener(instance, sqlvm_resource_id):
      '''
      Remove a SQL virtual machine from an availability group listener.
      '''
      if not is_valid_resource_id(sqlvm_resource_id):
          raise CLIError("Invalid SQL virtual machine resource id.")
  
      vm_list = instance.load_balancer_configurations[0].sql_virtual_machine_instances
  
      if sqlvm_resource_id in vm_list:
          instance.load_balancer_configurations[0].sql_virtual_machine_instances.remove(sqlvm_resource_id)
  
      return instancf remove_sqlvm_from_aglistener(instance, sqlvm_resource_id):
      '''
      Remove a SQL virtual machine from an availability group listener.
      '''
      if not is_valid_resource_id(sqlvm_resource_id):
          raise CLIError("Invalid SQL virtual machine resource id.")
  
      vm_list = instance.load_balancer_configurations[0].sql_virtual_machine_instances
  
      if sqlvm_resource_id in vm_list:
          instance.load_balancer_configurations[0].sql_virtual_machine_instances.remove(sqlvm_resource_id)
  
      return instance
docs: Remove a SQL virtual machine from an availability group listener.