Microsoft said it would spend more money this fiscal year to build out artificial intelligence infrastructure even as growth slowed in its cloud business.