As a civilian, Mr. Fanning never had to conform to the “don’t ask, don’t tell” policy governing gay service members, which was in place for more than 15 years. But his appointment demonstrates that Mr. Obama and Mr. Carter want to keep pushing the military toward more openness toward gay men and lesbians, an administration official said, speaking on the condition of anonymity to speak freely.

The official noted that the administration has been working to eliminate barriers to military service based on sexuality or gender. Defense Department officials say they believe the changes since the repeal of “don’t ask, don’t tell” have largely been a success. They say that none of the dire predictions of opponents, like a potential exodus of troops, have occurred, and that recruiting, retention and overall morale have not been affected.

But gay and straight service members say that ending the legal barriers has not erased all the cultural barriers. Some gay service members say they experience harassment and discrimination.

Mr. Fanning, 47, a graduate of Dartmouth, is well liked at the Pentagon, and his appointment was widely expected. As Army secretary, Mr. Fanning, who has served as chief of staff to Mr. Carter, would exert influence over the selection of generals and over Army policy, including the integration of women into combat roles, training of combat forces and purchase of weapons.

Gay rights groups hailed Mr. Fanning’s appointment.

“We are thrilled to see Eric Fanning nominated to lead the world’s greatest army,” said Ashley Broadway-Mack, the president of the American Military Partner Association, a support organization for lesbian, gay, bisexual and transgender military families. “History continues to be written and equality marches forward with the nomination of an openly gay man to serve in this significantly important role.”