Foreign citizens and persons without citizenship can purchase Visa to Azerbaijan by two types. Firstly, the visa is issued through diplomatic and consular representations of Azerbaijan or the consular department of the Ministry of Foreign Affairs of Azerbaijan. You can find more information about it by following link
Furthermore, citizens of countries listed in following link can also get an electronic visa via ASAN Visa. E-visa is issued within 3 (three) working days, it will be valid for 30 days and the fee for it is 20$. To get the electronic visa you can click on the following link to the website of ASAN Visa.