  High-quality factor microwave resonators operating in a magnetic field are a
necessity for some quantum sensing applications and hybrid platforms. Losses in
microwave superconducting resonators can have several origins, including
microscopic defects, usually known as two-level-systems (TLS). Here, we
characterize the magnetic field response of NbTiN resonators patterned on
sapphire and observe clear absorption lines occurring at specific magnetic
fields. We identify the spin systems responsible for these features, including
a yet unreported spin with $g=1.85$ that we attribute to defects in the NbTiN
thin film. We develop mitigation strategies involving namely an aluminum etch
mask, resulting in maintaining quality factors above $Q>2 \times 10^5$ in the
range $0$-$0.3$ T.
