A number of different scenarios have been proposed to explain the formation of massive stars. These include formation through the merger of less massive stars (coalescence model) or through the accretion of unbound gas from the molecular cloud (competitive accretion model). In the third scenario, the core accretion model, massive stars form through gravitational collapse, which involves disc-assisted accretion to overcome radiation pressure. This scenario is similar to the favored picture of low-mass star formation. Despite the likely importance of magnetic fields in the formation of low-mass stars, there are still only a few observations around massive stars, and theoretical simulations match the observations as long as the magnetic field is taken into consideration. Therefore, providing new measurements of magnetic fields orientation and strength at milliarcsecond resolution is fundamental
to understand the formation process of high-mass stars. The best probes of magnetic fields in the high density regions close to massive protostars currently available are masers. In particular 6.7-GHz methanol and 22-GHz water masers. In the last six years we have studied the magnetic field around several massive young stellar objects by observing the polarized emission of water and, mainly, methanol masers. In my colloquium I will go through the results that we have achieved so far by emphasizing the most interesting cases.