This work considers energy management in a grid-connected microgrid which consists of multiple conventional generators (CGs), renewable generators (RGs) and energy storage systems (ESSs). A two-stage optimization approach is presented to schedule the power generation, aimed at minimizing the long-term average operating cost subject to operational and service constraints. The first stage of optimization determines hourly unit commitment of the CGs via a day-ahead scheduling, and the second stage performs economic dispatch of the CGs, ESSs and energy trading via an hour-ahead scheduling. The combined solution meets the need of handling large uncertainties in the load demand and renewable generation, and provides an efficient solution under limited computational resource which meets both short-term and long-term quality-of-service requirements. The performance of the proposed strategy is evaluated by simulations based on real load demand and renewable generation data.