Obito had Izanagi because he was able to use the Sharingan to cast the genjutsu. By using the Sharingan, Obito was able to trap Madara in an illusion. In this illusion, Madara was unable to move or attack. This allowed Obito to use his Mangekyou Sharingan to cast the Izanagi Genjutsu on Madara.