def get_machine_id_change_spec(client_factory, machine_id_str):
    """Builds the machine id change config spec."""
    virtual_machine_config_spec = client_factory.create(
        'ns0:VirtualMachineConfigSpec')
    opt = client_factory.create('ns0:OptionValue')
    opt.key = 'machine.id'
    opt.value = machine_id_str
    virtual_machine_config_spec.extraConfig = [opt]
    return virtual_machine_config_spec
