Recent natural disasters such as hurricanes Harvey and Maria have caused great disruption to the electric grid system. Additionally, government authorities have set ambitious goals to reduce greenhouse gas emissions. Thus, there is a growing interest in making the electric power systems more resilient while reducing their carbon footprint. In this work, we used HOMER Grid software to model behind-the-meter microgrids consisting of PV, battery, natural gas generator, and the electric load of an office building that consumes an average of 2 MWh per day. We varied the component sizes to determine the configuration with the lowest generator size to provide power during a two-day outage in the summer peak load. Environmental and economic analysis were performed to show the tradeoffs between different system design goals. The results indicate that installing a microgrid in an office building with a 600 kW PV array and 2.8 MWh lithium-ion battery can avoid the release of up to 287 tons of CO2 per year. The same microgrid configuration can endure a two-day blackout during the highest electric demand in the hurricane season without the need of a polluting backup generator. Microgrids will play an important role in the transition to a smart grid because they provide reliable power, make the system more grid-failure tolerant, and allow a high penetration of renewable energy into the electric grid which consequently reduces the environmental impact.