Pete Hegseth, President Donald Trump’s embattled pick to lead the Pentagon, faced some Republican opposition, but not enough to stop him from being confirmed.