The extent to which COVID-19 diagnosis and vaccination during pregnancy are associated with risks of common and rare adverse pregnancy outcomes remains uncertain. We compared the incidence of adverse pregnancy outcomes in women with and without COVID-19 diagnosis and vaccination during pregnancy. We studied population-scale linked electronic health records for women with singleton pregnancies in England and Wales from 1 August 2019 to 31 December 2021. This time period was divided at 8th December 2020 into pre-vaccination and vaccination roll-out eras. We calculated adjusted hazard ratios (HRs) for common and rare pregnancy outcomes according to the time since COVID-19 diagnosis and vaccination and by pregnancy trimester and COVID-19 variant. Amongst 865,654 pregnant women, we recorded 60,134 (7%) COVID-19 diagnoses and 182,120 (21%) adverse pregnancy outcomes. COVID-19 diagnosis was associated with a higher risk of gestational diabetes (adjusted HR 1.22, 95% CI 1.18-1.26), gestational hypertension (1.16, 1.10-1.22), pre-eclampsia (1.20, 1.12-1.28), preterm birth (1.63, 1.57-1.69, and 1.68, 1.61-1.75 for spontaneous preterm), very preterm birth (2.04, 1.86-2.23), small for gestational age (1.12, 1.07-1.18), thrombotic venous events (1.85, 1.56-2.20) and stillbirth (only within 14-days since COVID-19 diagnosis, 3.39, 2.23-5.15). HRs were more pronounced in the pre-vaccination era, within 14-days since COVID-19 diagnosis, when COVID-19 diagnosis occurred in the 3rd trimester, and in the original variant era. There was no evidence to suggest COVID-19 vaccination during pregnancy was associated with a higher risk of adverse pregnancy outcomes. Instead, dose 1 of COVID-19 vaccine was associated with lower risks of preterm birth (0.90, 0.86-0.95), very preterm birth (0.84, 0.76-0.94), small for gestational age (0.93, 0.88-0.99), and stillbirth (0.67, 0.49-0.92). Pregnant women with a COVID-19 diagnosis have higher risks of adverse pregnancy outcomes. These findings support recommendations towards high-priority vaccination against COVID-19 in pregnant women. BHF, ESRC, Forte, HDR-UK, MRC, NIHR and VR.