Shirvan (Second Unification of Georgia)

Shirvan (from Persian: شروان‎,  translit.  Shirvān; Tat: Şirvan), also spelled as Sharvān, Shirwan, Shervan, Sherwan and Šervān, is a historical region in the eastern Caucasus, known by this name in both Islamic and modern times.[1] Today, the region stretches between the western shores of the Caspian Sea and the Kura River and is centered on the Shirvan Plain.

History
Shirvan was controlled by Caucasian tribes from antiquity. Persian influence began to increase in early middle ages before the region was was conquered and subsequently islamized by the Arabs in VII-VIII Centuries.

Shirvanshahs
Shirvanshahs were a persianized arab dynasty that controlled shirvan from IX-XV c. Shirvanshahs spent most of their history as Vassals of various other nations such as Seljuqs, Georgians, Mongols, Timurids etc. Shirvanshah dynasty ceased to exist in 1538, when last Shirvanshah ruler (Who was only a vassal of Safavids) was deposed by Shah Tahmasp I. Shirvan Would Stay in Safavid hands for more than 100 years before being conquered by Ottomans.

Safavid Shirvan
Velāyat-e Shirvān was ruled by beglarbegs who were appointed by Safavids Shahs. During Safavid rule over Shirvan Sunni Islam was forcefully replaced with Shiism, Safavids also began to settle Turkic tribes in the area to consolidate their power. 131 year long Safavid control of shirvan ended in 1669, when King Bagrat VIII of Georgia besieged then took Baku. Bagrat wished to keep Shirvan for himself but his liege, The Ottoman sultan declined and imposed a direct rule instead.

Pashalik of Shirvan (Ottoman Empire)
Ottoman sultan granted Shirvan to certain man known as Mustafa, who then adopted Sirvanoglu as his surname. Mustafa restarted cultural upheaval of shirvan which was lost after Safavid conquest. Mustafa was a great administrator and under his rule Shirvan was as prosperous as during the Shirvanshah age.

March of Shirvan (Kingdom of Georgia)
In 1683 Ottoman Empire suffered a heavy defeat at Vienna which left the Empire undefended, especially the border provinces. Bagrat VIII seized the opportunity to break free from his liege and expand his own domains.