The occurrence of unforeseen incidents is one of the major causes of extensive blackouts and financial damages to electrical networks. The utilization of distributed energy resources (DERs) as a local energy supplier can potentially reduce the destructive effects of unforeseen events along with their benefits for the normal operation of the network. In this paper, a new framework is proposed for the optimal siting and sizing of solar photovoltaic distributed generations (PVDGs) and battery energy storage systems (BESSs) in the distribution network to increase resiliency against the earthquake event considering the advantages of these resources in both normal and event conditions. Furthermore, an optimal energy pattern for BESSs has been provided that, in addition to being used for the normal condition, also prepares them for transferring to the emergency state. The objective function is formulated as a mixed‐integer linear programming (MILP) problem aiming at minimizing both the normal and emergency costs. Eventually, the numerical results of implementing the proposed model on the IEEE‐33 bus system are presented to illustrate its effectiveness and accuracy. These results show by using PVDG installation, the resilience can be improved by 14% while total installation and operating costs are reduced by 1.7%. It is possible, however, to decrease the load curtailment up to 55.46% by involving BESSs along with PVDGs, despite an 8.57% increase in costs.