McMaster, whom Mr. Trump called “a man of tremendous talent and tremendous experience,” accepted the post, making him the first active-duty U.S. military officer to take the job since Colin Powell and John Poindexter held it under President