The uncertainty of renewable distributed energy (photovoltaic, wind power, etc.) and load demand in the microgrid poses challenges to the economy and safety of microgrid operation. This paper proposes a robust optimization model of microgrid considering uncertainty to take into account the economy and robustness of microgrid operation. A two-stage robust optimization model is established to find a balance between the economy and robustness of microgrid operation. Through the optimization procedure, the robust adjustment parameters for microgrid operation can be obtained. The optimized can effectively balance the economy and robustness. The Benders dual algorithm is used to solve the established two-stage robust optimization model. The CPLEX solver is used to simulate the IEEE39-bus system to verify the feasibility and effectiveness of the method. The simulation results show that the robustness of the system can be achieved by solving the robust adjustment parameters, meanwhile the operating cost can be reduced as much as possible no matter in the buying electricity scenario or in the selling electricity scenario.