Microsoft’s expanding opportunity in the artificial intelligence market has reinvigorated investor excitement and lifted the stock to a record.