The transient energy margin of large-scale power-electronic-interfaced microgrid is very limited. Typically, this margin is stored in the rotor of synchronous generators which acts as a low pass filter for power system disturbances. In microgrid, the transient frequency ride through (TFRT) capability becomes very limited or marginal. Thus, the system stability is induced under small disturbance conditions, which results in large frequency deviation upon any load change or source on/off switching. This paper proposes a novel method to suppress the frequency variation by controlling the energy stored in multiple dc link capacitors based on the instantaneous energy mismatch between the supply and the demand. The Energy Shaping Process (ESP) proposed here aims to control the magnitude and the insertion time of the released energy from multiple coordinated dc links such that the frequency nadir and the rate of change of frequency (RoCoF) are both minimized. The ESP considers the sign of the energy mismatch, the sign of the frequency variation, and the sign of frequency variation's derivative. ESP provides flexible virtual inertia. The results show that ESP is very efficient in suppressing the energy mismatch, as well as, the frequency variation during transient events, which leads to stable and reliable microgrid operation.