Honestly they had it easy because of inertia and because they managed to build a successful business with cloud technology.
Had they failed with Gaming, Office365 + Azure the same way they failed in the mobile market, Microsoft would not be the same company as it is today and as it was 20 years ago.