Conversion of pregnenolone and progesterone to their 17- alpha-hydroxylated products and subsequently to dehydroepiandrosterone (DHEA) and androstenedione. Catalyzes both the 17-alpha-hydroxylation and the 17,20-lyase reaction. Involved in sexual development during fetal life and at puberty. Defects in CYP17A1 are the cause of adrenal hyperplasia type 5 (AH5). AH5 is a form of congenital adrenal hyperplasia, a common recessive disease due to defective synthesis of cortisol. Congenital adrenal hyperplasia is characterized by androgen excess leading to ambiguous genitalia in affected females, rapid somatic growth during childhood in both sexes with premature closure of the epiphyses and short adult stature. Four clinical types: salt wasting (SW, the most severe type), simple virilizing (SV, less severely affected patients), with normal aldosterone biosynthesis, non-classic form or late onset (NC or LOAH), and cryptic (asymptomatic). Belongs to the cytochrome P450 family. Note: This description may include information from UniProtKB.