Energy resiliency plays an important role in the proper functioning of data centers as they heavily rely on an uninterrupted power supply to ensure smooth operation. In the case of a power outage, the data center’s operation might be hampered, which results in system downtime, data, and economic loss. This issue is severe in developing countries where power supply infrastructures are inadequate and conventional. Microgrids can be an effective solution in this regard. Although several studies developed microgrids to observe the energy resilience benefit for some critical facilities, critical facilities like data centers are often overlooked. In addition, sustainability analysis of a microgrid is also scarce in the present literature. Therefore, one new resilience and sustainability indicator has been developed and implemented in this analysis to fill this gap. For this, new indicators, such as the resilience cost index (RCI) and renewable energy penetration (REP), were used in this study. This study used HOMER version 3.13.3 and REopt software to simulate a robust photovoltaic (PV) and battery microgrid for a hypothetical data center in Bangladesh. A random (48 h) outage was assigned to witness the adaptability of the modelled micro-grid. The suitable size of PV and battery was found to be 249,219 kW and 398,547 kWh, respectively. The system’s USD 18,079,948 net present value (NPV) demonstrates the economic potential of utilizing PV and battery microgrids for data centers. The RCI of the system is found to be 35%, while the REP is 87%. The energy consumption saving of the system is USD 21,822,076. The system emits 652% less CO2 than the grid. The result of this system is also compared with a diesel-based system. After comparison, it is found that the developed PV/battery microgrid provides better environmental and economical service than the diesel generator. During blackouts, the system keeps the data center powered up without interruption while improving energy resilience and lowering carbon emissions. The outcome of this current analysis can serve as a blueprint for other microgrid projects in Bangladesh and other developing countries. By integrating PV/battery microgrids, data centers can cut costs, reduce emissions, and optimize energy use. This will make data centers less reliant on grid services and more flexible to forthcoming development.