Microsofts mobile division was always doomed. No one cares for the nokia brand anymore.
Microsoft struggles with adoption to windows phone, so they buy the least popular mobile hardware company... makes sense.
They needed to buy (or partner with) a popular yet a not-samsung/apple-level-of-popular brand to elevate windows phone sales.
Hell Sony mobile has a bit of a following, if Sony made a flagship windows phone for MS, it could have worked well.
Also, probably impossible but windows phone needs access to android store. Pay google a small cut if tech-wise it is possible and you remove one barrier for entry.