Reliability and resilience are the main drivers for the transition of distribution networks from passive systems to active microgrids; as such, quantifying the potential benefits of microgrids in the design phase can support the transition of passive distribution networks into microgrids. To support this transition, this paper presents a mathematical optimization model which integrates techno-economic, resilience and reliability objectives. Storage and distributed generation are optionally installed to complement renewable generation, enabling the microgrid to supply priority demands during stochastic islanding events with uncertain duration. Islanding due to external events is combined with a detailed model of internal faults for comprehensive quantification and optimization of microgrid resilience and reliability. Minimizing the interruption costs yields optimal capacities and placements of distributed energy resources and new lines for reconfiguration. The proposed method produces microgrid designs with up to 95% reliability and resilience gain and moderate cost increase in two benchmark distribution networks using data from the United States Department of Energy. The developed methodology is scalable to large networks owing to the tailored Column-and-Constraint-Generation approach, reducing the computational time by 92% compared to state-of-the-art Benders decomposition for a 123 bus network.