I cannot speak specifically about Azerbaijan, but crude oil was used throughout much of ancient and medieval history.
Ancient peoples in Mesopotamia and Syria used bitumen, a heavy tar that forms when oil from natural seeps is exposed to the elements, was used as mortar in construction and a sealant in shipbuilding. This is known to have continued into the medieval era.
In the medieval Islamic world, crude oil played a big part in alchemy, and oil products were used both in experimental and practical purposes. The alchemists invented a primitive form of distillation, using a still called an alembric to extract naphtha - the clear, volatile fraction of the petroleum that would roughly correspond to our kerosene or gasoline. The Book of the Secret of Secrets describes this "white naft" as a solvent for certain earthy substances. Alongside animal and plant oils, it was used for illumination and in heating for alchemical work.
Petroleum products are also recorded to had been used in incendiary weapons.
Marco Polo does address that as well. It's in the end of his chapter 'De la Grande Erminia'.
Di verso tramontana confina con Giorgens, e in queste confine è una fontana, ove surge tanto olio e in tanta abondanza che 100 navi se ne caricherebboro a la volta. Ma egli non è buono a mangiare, ma sí da ardere, e buono da rogna e d’altre cose; e vegnoro gli uomini molto da la lunga per quest’olio; e per tutta quella contrada non s’arde altr’olio.
«To the north on the border with Georgia there is a fountain of oil which could fill a 100 ships at a time. Although the oil is inedible it burns well and it good for scabies and a variety of other things. A plenty of men go a long way to get their hands at this particular oil and all around the place it is used when no other oil is at hand.»
This "variety of other things" may for instance include the production of asphalt. It's been mentioned by Herodotus and it was used in Bronze Ae Mesopotamia and in the Indus Valley civilization.