One of the major problems of the operators of electricity networks is the operation of the network during events. Events with high impact and low probability of occurrence are a type of events that can cause severe disruptions in power grids. Therefore, the power grid must be resilient in dealing with such events. In recent years, electricity network operators have tried to improve the conditions of using distribution networks by using methods called flexibility. This paper aims to use flexible methods, such as energy storage systems and demand response programs to increase resiliency, reduce costs, and level the power exchange curve with the sub‐distribution substation. Therefore, first, the modeling of energy storage systems and demand response programs is presented in the energy management problem. Then, the mentioned models are integrated with the problem of the resilient operation of the two‐way distribution network. Also, considering the parameters of active and reactive loads and active generation of wind and solar renewable energy resources, uncertainty is considered in the problem. The resilient operation model has been considered and rewritten again, considering the robust optimization method for modeling uncertainties. Finally, a resiliency index is provided to show the resiliency of a network in a relative manner. In the proposed model, the simulation is done on IEEE 33‐bus network in four states and six cases. The states considered include grid operation without energy storage systems and demand response programs, operation with energy storage systems, operation with demand response programs, and operation with the simultaneous presence of energy storage systems and demand response programs. Also, in this paper, six cases include operation in normal conditions for comparison with other cases, operation in outage conditions of one‐way and two‐way busses connected to the sub‐distribution substation, operations in disconnection of some local resources, and network lines have been investigated. The results obtained from this research indicate the improvement of resiliency conditions using the method considered.