Microsoft is cutting jobs in its commercial business and its Xbox gaming group, where revenue has been shrinking.