We have experimentally investigated the influence of a magnetic interaction between the grains on the flow of a granular material in a rotating drum. The magnetic cohesion is induced by applying a homogeneous external magnetic field B oriented either parallel or perpendicular to the gravity g. The drum rotating speed has been selected to obtain a continuous flow when the magnetic field is switched off. We show that, for both magnetic field orientations, the cohesion is able to induce a transition between the continuous flow regime to the discrete avalanche regime. The avalanche dynamics is periodic when B⊥g and irregular when B∥g. Moreover, the maximal angle of stability θ(m) increases strongly with the cohesion strength and could be higher than 90° when B⊥g. A toy model based on the stability of a magnetic block on a magnetic inclined plane is proposed to explain this behavior.