It depends on your nationality. Citizens of more than 90 countries can apply online through the official ASAN e-Visa system — no embassy visit, no paperwork by post.
The ASAN e-Visa is issued electronically and arrives by email. These are its standard terms.
The list of eligible countries and the current fee are on the official portal. If your country is not on it, you will need to apply through an Azerbaijani embassy or consulate.
The visa is single entry and valid for a limited window from the date it is issued, so applying many months ahead is not useful.
You will need your passport details and a card. Check every field against your passport — a mistyped name or number is the most common reason an application has to be redone.
The e-Visa arrives as a PDF by email. Keep it where you can reach it without internet, and have a printed copy for the airline desk and passport control.
Build your itinerary and see the price straight away — then apply for the visa with your dates already settled.