Either way is ok. Firstly, you have to get your admission from university. After you finish your master degree, you can extend your visa and study permit to continue your phd degree. Mostly, you apply master first, but you get an implicit admission from supervisor if you finish your master, you...