The process in which microorganisms use light energy to produce organic compounds from inorganic substances.