This paper presents an energy management system (EMS) for single-phase or balanced three-phase microgrids via robust convex optimization. Along a finite planning horizon, the solution provided by the proposed microgrids EMS remains feasible under adverse conditions of random demands and renewable energy resources. The proposed model is represented as a convex mixed-integer second-order cone programming model. Two operation modes are considered: grid-connected and isolated. In grid-connected mode, the proposed EMS minimizes the costs of energy imports, dispatches of distributed generation (DG) units, and the operation of the energy storage systems. In isolated mode, the proposed EMS minimizes the unsupplied demand considering consumer priorities. Global robustness of the proposed mathematical model is adjusted using a single parameter \zeta . The robustness of the solutions provided by the robust EMS are assessed using the Monte Carlo simulation method. In this case, DG units are set to operate in frequency and voltage droop control to support network fluctuations. Simulations are deployed using a microgrid with 136-nodes and several distributed energy resources. Results showed that the proposed model is suitable for the short-term microgrids energy management system. The robustness of the final solution was directly proportional to the operational costs, and it can be effectively controlled by the proposed parameter \zeta for both operation modes. When compared to stochastic approaches, the proposed formulation proved to be more flexible and less time-consuming.