This paper deals with the design of community-scale microgrids. A generic system is considered consisting of solar photovoltaics, wind turbine, microturbine, battery array, and electric boiler. The microgrid is grid-connected and designed to supply both heat and power. It is constrained to meet 100% of the energy demand. An optimal design is found to minimize the cost of energy supply over a 20 year lifespan. The optimal design is analysed with respect to technology cost and environmental policy in the form of CO2 taxation. Use of combined heat and power is found to lower cost of energy supply in all cases. CO2 taxation is found to be ineffective in promoting greener power supply for this system unless coupled with reductions in renewable technology cost.