Micro-arc oxidation coating on AZ91D magnesium alloy is prepared in a NaAlO2-NaOH-montmorillonite-acacia gum electrolyte solution with adaptive electric parameters. The morphologies, composition, phase component of the coatings are analyzed by SEM, EDS and XRD. And CHI600B electrochemistry workstation is employed to investigate the corrosion resistance of the coatings. The results show that the MAO coating has the relatively uniform in thickness. The coating is mainly composed of MgO and MgAl2O4 phases. It provides corrosion protection by acting as a barrier. The MAO coating enhances the corrosion resistance of the magnesium alloy AZ91D to some extent.