Here, we describe a protocol combining adeno-associated virus injection with cranial window implantation for simultaneous imaging of microglial dynamics and neuronal activity in awake mice.