Microglia are the main resident macrophage population of the CNS and perform numerous functions required for CNS development, homeostasis, immunity, and repair. Many lines of evidence also indicate that dysregulation of microglia contributes to the pathogenesis of neurodegenerative and behavioral diseases. These observations provide a compelling argument to more clearly define the mechanisms that control microglia identity and function in health and disease. In this Review, we present a conceptual framework for how different classes of transcription factors interact to select and activate regulatory elements that control microglia development and their responses to internal and external signals. We then describe functions of specific transcription factors in normal and pathological contexts and conclude with a consideration of open questions to be addressed in the future.