I am an American citizen planning to fly from Tel Aviv to Lviv, Ukraine in mid-August. The cheapest/most time-effective route I can find takes me through Baku's Heydar Aliyev International Airport. The layover lasts about 2.5 hours. Do I need a visa for this short visit? From past experience transiting through foreign countries, I would guess no, given that I am not leaving the airport. Thanks for your help!
As always, Timatic is the definitive source for these sorts of questions. Here's what it says for a US citizen transiting Azerbaijan:
Transit - Azerbaijan (AZ)
TWOV (Transit Without Visa):
Passengers with a confirmed onward ticket for a flight to a third country within 72 hours. They must stay in the international transit area of the airport and have documents required for the next destination.
So you should be OK, so long as you can have your baggage checked all the way to Lviv when you board the plane in Tel Aviv. This is usually the case if you buy the flights as a single itinerary, but beware of any itinerary where you would have to claim & re-check your baggage in Baku.
As an aside: you say that
From past experience transiting through foreign countries, I would guess no, given that I am not leaving the airport.
A lot of countries do indeed allow for transit without visa, so long as you stay in the "sterile" region of the airport. The major exception, though, is the United States itself; as a general rule, foreign citizens transiting through the USA must obtain a visa. As a US citizen, you don't personally have to worry about this; but it's worth noting that this issue can present major difficulties to international travelers from other countries.