Increasing the redundancy of distribution lines and increasing the penetration of distributed energy resources (DERs) both help microgrids ride through contingencies. However, it remains a challenging problem for how to coordinate these two measures for minimising the deployment cost while guaranteeing a pre-specified degree of resilience in case of contingencies. Accordingly, this study proposes a novel microgrid planning model to site and size candidate sets of DERs and distribution lines in close coordination, which is mathematically equivalent to a two-stage robust optimisation problem. In particular, the resilience level of microgrid operations is quantified and maintained such that the load loss is constrained within a given bound under any realisation of N
–
k contingencies. The proposed model also incorporates a practical strategy to maintain the radial topology of islanding network sections in any N
–
k contingency. Finally, numerical experiments based on two microgrid test systems are performed. The results show that the system resilience is adaptively enhanced through optimally placing DERs and distribution lines compared with the conventional economics based model. Moreover, the employed robust method is at least ten times faster than the reliability-based method in identifying the worst contingency.