Microsoft is getting more disciplined on AI spending and is better positioned than rivals for a consumer-spending slowdown, according to one analyst.