Many transition-metal containing materials exhibit fascinating phenomena, leading to important technological applications. Among the most important properties are those arising from magnetic effective interactions, which are governed by the interactions between the unpaired spins, which are essentially localized on the transition-metal ions. Their isotropic interactions lead to the “parallel” or “antiparallel” alignments of the spins, these are the so-called ferromagnetic and antiferromagnetic interactions, respectively. Due to relativistic effects such as spin-orbit coupling, the spin moments can also interact anisotropically. This type of interactions has been found to be responsible, for instance, for the so-called weak ferromagnetism. Also, the discovery of ferroelectricity in materials with spin-spiral magnetic ordering added to the importance of magnetic anisotropy in materials, with a special focus on the Dzyaloshinskii-Moriya interactions. Nevertheless, quantum mechanical studies of magnetic anisotropy have so far been rather limited. This is in part related to the difficulties in extracting the anisotropic interaction parameters as defined in phenomenological spin Hamiltonians. Another reason is that density functional theory has important limitations for treating anisotropic magnetic couplings. Therefore, the use of accurate wave function based treatments accounting for electron correlation and relativistic effects is more attractive. For extended systems like solids, the application of such methods is however not trivial. In our approach, embedded cluster models are used, where only a small part of the material is fully treated quantum mechanically. The first step of the calculations consists in determining complete active space self-consistent field (CASSCF) wave functions, which is adequate for treating near-degeneracy electron correlation, but that cannot fully include dynamical correlation. An approximate but efficient way to remedy this is to use second-order perturbation theory, as is done in the CASPT2 approach; a more accurate but also more costly route is to use Difference Dedicated Configuration Interaction (DDCI). DDCI is especially well suited to compute the small energy differences between states with different spin couplings. Our approach allows us to obtain the lowest energy states in embedded clusters, use these to calculate the isotropic and the spin-orbit-coupling driven anisotropic magnetic interactions in solids and unambiguously obtain the corresponding interaction parameters. The methods will be illustrated with studies of CuO and LiCu2O2.