Having spent billions on AI infrastructure, Microsoft now wants to trim its headcount.