Microsoft shares have suffered their largest decline in more than five years, falling 10% this week after the company reported record spending on artificial intelligence alongside slowing growth in its key cloud unit.