Microsoft announced a new $40 billion share buyback on Tuesday as part of an effort by the transitioning US tech giant to return more cash to stockholders.