Automatic reconfiguration is one of the key actions in self-healing distribution networks. In these networks, after detecting and isolating the faulted portion, an automatic reconfiguration procedure is performed to restore the maximum possible affected loads without further interruptions during repair operations. This procedure becomes more complicated in the networks with integrated distributed generation units as they can bring security challenges for the reconfigured network after a fault event. To overcome these challenges, a stochastic framework is proposed here. In this framework, the reconfiguration procedure is conducted with a fast and reliable method which is based on the graph theory. Besides, the security challenges of utilizing distributed generations after an event are highlighted. Then, since a faulted network is more prone to subsequent faults, different actions of changing the distribution generations output power, preventing the insecure increment of short circuit capacity, and also considering the loadability improvement are proposed in the reconfiguration framework. Then in the final stage, the vulnerability of the distribution system to the uncertainties of load demand is resolved through a chance-constrained programming-based approach. To see the performance of the proposed stochastic framework, it is tested on a standard test system and the results prove its goodness and applicability for real distribution networks.