In this paper, we present an optimal energy management framework for a cooperative network of heterogeneous microgrids (MGs) where energy exchange among connected MGs is allowed to exploit the fluctuations of stochastic energy sources and demands. A multi-objective function is introduced that seeks to achieve an efficient tradeoff between low operation cost and good energy service for customers. The objective function captures the total cost of power exchange with the main grid, the startup and shutdown costs, the operating cost of distributed generators (DGs), the payment for demand response load, the penalty costs for involuntary load curtailment, and renewable energy spillage. We propose to employ the scenario-based two-stage stochastic optimization approach to deal with the uncertainties of renewable energy resources and load demand in the energy scheduling problem. The efficacy of the proposed energy management solution is demonstrated via numerical results.