We have investigated the alignment of a liquid crystal whose orientation is controlled by photoisomerization reaction for use in developing optical devices to improve beam quality. A glass window of a liquid-crystal cell that is coated with poly(vinyl alcohol) doped with azo dye was illuminated with a Hg lamp. We confirmed the dependence of the spatially controlled alignment direction of a liquid crystal on the irradiation time of this ultraviolet light. The new azo dye used in this study substantially reduced the illumination energy density required for aligning liquid-crystal molecules. We have demonstrated the control of polarization and successfully fabricated a serrated apodizing aperture and a soft aperture.