An indirect contact lens is mechanically coupled to a surgical microscope during ophthalmic surgery, such as vitreoretinal surgery. The indirect contact lens rests on a cornea of an eye of a patient during the surgery but is supported by a surgical microscope attachment having multiple degrees of freedom to accommodate small movements of the eye while remaining aligned to an optical axis of the surgical microscope.