The US Constitution, limits what a former US military officer can do as follows:
No Title of Nobility shall be granted by the United States: And no Person holding any Office of Profit or Trust under them, shall, without the Consent of the Congress, accept of any present, Emolument, Office, or Title, of any kind whatever, from any King, Prince, or foreign State.
Article I Section 9
But Congress has acted and all you need to do is ask for permission as follows:
(a)Congressional Consent.—Subject to subsection (b), Congress consents to the following persons accepting civil employment (and compensation for that employment) for which the consent of Congress is required by the last paragraph of section 9 of article I of the Constitution, related to acceptance of emoluments, offices, or titles from a foreign government:
A person described in subsection (a) may accept employment or compensation described in that subsection only if the Secretary concerned and the Secretary of State approve the employment.
(c)Military Service in Foreign Armed Forces.—
For a provision of law providing the consent of Congress to service in the military forces of certain foreign nations, see section 1060 of title 10.
37 U.S. Code § 908 – Employment of reserves and retired members by foreign governments