I took 2 azithromycin for an infection and threw up 30 min later. Will the antibiotics still work?

Maybe not. Although Azithromycin is rapidly absorbed after it is ingested, 30 minutes may not have been long enough to allow enough of the drug to be absorbed for it to be effective. You should talk to your doctor about repeating the dose.