Interfacing photonic and solid-state qubits within a hybrid quantum architecture offers a promising route towards large scale distributed quantum computing. Ideal candidates for coherent qubit interconversion are optically active spins, magnetically coupled to a superconducting resonator. We report on an on-chip cavity QED experiment with magnetically anisotropic Er(3+)∶Y2SiO5 crystals and demonstrate collective strong coupling of rare-earth spins to a lumped element resonator. Moreover, the electron spin resonance and relaxation dynamics of the erbium spins are detected via direct microwave absorption, without the aid of a cavity.