Google and Microsoft are among companies that have had to figure out whether their technology should be used by the U.S. military amid pressure from employees.