Power system security against attacks is drawing increasing attention in recent years. Battery energy storage systems (BESSs) are effective in providing emergency support. Although the benefits of BESSs have been extensively studied earlier to improve the system economics, their role in enhancing the system robustness in overcoming attacks has not been adequately investigated. This paper addresses the gap by proposing a new battery storage sizing algorithm for microgrids to limit load shedding when the energy sources are attacked. Four participants are considered in a framework involving interactions between a robustness-oriented economic dispatch model and a bilevel attacker-defender model. The proposed method is tested with the data from a microgrid system in Kasabonika Lake of Canada. Comprehensive case studies are carried out to demonstrate the effectiveness and merits of the proposed approach.