Galactic Republic: Jedi General (multiple), Representative to the Jedi Council in the Office of the Chancellor (Anakin Skywalker)
There aren't any instances of the Jedi holding an elected political rank. During the Clone Wars, a number of Jedi were given the rank of Jedi General, which was the highest military rank (recall that the Galactic Republic did not have a standing military before this). Jedi Generals included most of the Jedi Masters and Jedi Knights, including Yoda, Mace Windu, Obi-Wan Kenobi, and Anakin Skywalker.
If we consider Jedi General to be a rank within the Jedi Order, rather than a political rank, then the honor goes to Anakin Skywalker, whom Supreme Chancellor Palpatine appointed to join his Office of the Chancellor as the representative to the Jedi Council.
Palpatine: Nevertheless, their actions will speak more loudly than their words. I'm depending on you.
Anakin: For what? I don't understand.
Palpatine: To be the eyes, ears, and voice of the Republic. [Anakin considers] Anakin, I'm appointing you to be my personal representative on the Jedi Council.
Anakin: Me? A Master? I am overwhelmed, sir, but the Council elects its own members. They will never accept this.
Palpatine: I think they will…they need you more than you know.
–Star Wars: Episode III Revenge of the Sith
In other words, Anakin became a member of Palpatine's administration to serve on the Jedi Council. This was a newly created position, and was unusual in that Palpatine directly appointed Anakin to serve in this capacity on the Jedi Council, instead of having the Council decide who should be part of them.
As a real-world equivalent, being part of the Office of the Chancellor would be like joining the Cabinet of the United States, an advisory board to the President.
If both Jedi General and Representative to the Jedi Council are considered political positions, it's not really clear which of the two is "higher".
Galactic Empire: Second in command for the Imperial Navy (Darth Vader)
Darth Vader (formerly Anakin Skywalker) was the second in command for the Imperial Navy, subservient to the Emperor and with the ability to promote even Admirals.
"You are in command now, Admiral Piett."
—Star Wars: Episode V The Empire Strikes Back
It does not appear that Disney Canon has given a name to Vader's position, but Legends calls the position "Supreme Commander".
Old Republic/Galactic Republic: Supreme Chancellor (multiple)
All of the Supreme Chancellors from c. 1400 BBY to 1000 BBY were Jedi, with Tarsus Valorum breaking the tradition as a non-Jedi.
It was these traits, along with his exemplary record of public service, that had led to Valorum being appointed the first non-Jedi Chancellor in over four centures.
—Darth Bane: Rule of Two
During the same time period that the Jedi were Chancellors, the Jedi also ran every branch of the military. They were disbanded as part of the Ruusan Reformation and the Jedi's political powers were severely limited.
"Do you realize the ramifications of what you are asking, Tarsus? Your proposal calls for the Jedi to renounce their military ranks and completely disband all our military, naval, and starfighter resources. You are asking us to destroy the Army of Light!"
—Darth Bane: Rule of Two
Rebel Alliance: General (Rahm Kota)
Rahm Kota was a Jedi General who survived Order 66 because he didn't believe clones were fit for battle and insisted on using his own militia. During the events of The Force Unleashed, he formally joins the newly created Rebel Alliance and becomes a General under their rankings.
I could not find any instance of a fully-trained Jedi serving in a non-military role.
Imperial Remnant: Supreme Commander (Luke Skywalker)
In 10 ABY, Emperor Palpatine was resurrected into a number of clone bodies and made Luke Skywalker fall to the Dark Side. He appointed Luke Supreme Commander of the Imperial Forces, giving him direct command over the Imperial military, a position that his father Darth Vader previously had held.
And yes, a clone of Palpatine really did bring Luke to the Dark Side, which apparently led him to dress like Vader. For what it's worth, pretty much every Legends writer afterwards ignored the events of the Dark Empire trilogy.
Imperial Remnant: Emperor (Kyle Katarn, non-canon)
In the non-canon Dark Side ending to Star Wars Jedi Knight: Dark Forces II, Jedi Knight Kyle Katarn takes over the Imperial Remnant and declares himself to be Emperor.
Sarris: Our spies bring word of a small Rebel uprising on Demita.
Katarn: I have no time for petty uprisings. Extinguish them painfully.
Sarris: Yes, Emperor.
—Star Wars Jedi Knight: Dark Forces II
New Republic: Triumvir (Saba Sebatyne)
The New Republic was originally led by a Chief of State, but after a coup that overthrew Natasi Daala, who abused her power, the position was abolished and replaced by the Triumvirate in 42 ABY. Under the Triumvirate, three individuals shared equal power as the supreme authority of the New Republic. Jedi Master Saba Sebatyne, also acting Grand Master of the Jedi Order, was one of these three. Luke later ordered the Jedi to withdraw, and she was replaced by a non-Jedi.
Of note, Leia Organa Solo was a two-time Chief of State in the New Republic before the Triumvirate, but had limited training from Luke. After the death of her son Anakin Solo in 27 ABY, she decided to leave politics. By 40 ABY, Leia Organa Solo became a fully-trained Jedi Knight. So while she did hold the highest position in the New Republic, she wasn't a fully-trained Jedi until later.
Fel Empire: Empress? (Jaina Solo Fel)
Jaina Solo Fel, daughter of Leia Organa Solo and Han Solo who was trained as a Jedi under the New Jedi Order, marries Jagged Fel. He later became Emperor of the Fel Empire (a.k.a. the New Order), which was the remnants of the Galactic Empire. It's possible that Jaina became Empress.
The specifics are cloudy. Out of universe, Star Wars Legacy was a time-skip comic series taking place after 130 ABY, but the last we see of Jaged Fel is in 44 ABY where he appears to be poised to take over the Imperial Remnant (at which point, the Legends line was discontinued in favor of Disney continuity). In Legacy, Jaged Fel is referred to as the first Emperor, so it seems he was successful. However, it isn't clear whether Jaina Solo Fel was ever given the title of Empress, or if she was even still alive after Jaged Fel successfully became Emperor.
Sith Empire: Galactic Emperor (Darth Krayt)
Darth Krayt overthrew Roan Fel, leader of the Fel Empire and became ruler of a new Sith Empire under his "Rule of One" replacing the longstanding Sith "Rule of Two". While most people are unaware of where he came from, it's eventually revealed that he was once the Jedi Master known as
A'Sharad Hett, who had been trained before the Clone Wars by Ki-Adi-Mundi and other Jedi. In fact, he was a recurring character in the earlier Star Wars: Republic comic series; Darth Krayt revealing his identity was a big surprise to longtime fans.
Galactic Federation Triumvirate: Triumvir (K'Kruhk)
In 136 ABY, three factions (the Galactic Alliance Remnant, the Empire-in-exile, and the New Jedi Order) overthrew Darth Krayt's Sith Empire and merged together into the Galactic Federation Triumvirate in which each group had a representative that shared power equally. Representing the New Jedi Order was K'Kruhk, who was actually part of the Jedi Order back during the Clone Wars (his species lives a long time).
"Emperor Fel would be heartened to know that his sacrifice was not made in vain. His selfless actions have unified the galaxy to form the Galactic Federation Triumvirate… which will be headed by Admiral Gar Stazi, Jedi Master K'Kruhk, and His Imperial Highness's daughter, Empress Marasiah Fel."
Note that Empress Marasiah Fel (descendent of Jaged Fel and Jaina Solo Fel, see above) was a member of the Imperial Knights, a force-sensitive organization that rejected the Dark Side, but was otherwise unaffiliated with the Jedi. Thus she or her ancestors aside from Jaina wouldn't count for this question.