There is little or no information of what happend in Baku between the Romans in the 1st century and until approximately the year 1000 where the region came under attack by the Rus, not Russia as we know it today, Rus was the area now known as Belarus, Ukraine and European Russia.
Baku was promoted to capital status in Shirvan after a devastating earthquake destroyed the city of Shamakay in 1191, and shortly after, the construction of massive fortifications around the city started. Work continued for the next 200 years or so in order to hold foreign invaders out of Baku. To this day it's still possible to see one of the city's original strongholds, the Maiden Tower.
The Venetian merchant traveller and explorer Marco Polo (1254-1324) journeyed through Baku on his great adventure to the Far East, and when returning to Europe, he told stories about the oil found there. Others soon followed in his footsteps who wanted to begin trading for this valuable commodity (nothing has changed then).
Tsar Peter the Great of Russia took control over Baku on the 26th of June, 1723, but soon left them to govern themselves. That was also the case when a major Russian campaign to conquer the whole Caucasus region arose in 1796. The area was captured, but the Russians withdrew once more.
When Tsar Alexander the First invaded the Caucasus in 1806 in the Russian war against the Turkish Empire, events took a different turn. The Russians won, and awarded the city of Baku status as the administrative capital of Transcaucasian region, the newest member of the Russian Empire.
Baku's first taste of the oil boom came in 1846, with the drilling of the first ever oil well. This paved the way and soon companies such as the Nobel Brothers from Sweden opened offices there alongside some one hundred other contractors. The oil rush caused Baku's population rate to explode, far outrunning that of both London and New York.
Now you might wonder why oil, already sold in Marco Polo's days, suddenly became such a sought after export commodity in the mid 1800's. Well the reason was that oil in Polo's days was not refined such as the product we know today, it was an untreated product, only used to provide lighting in buildings in the form of oil lamps.
During the Great War, from 1914 to 1918 also known as the First World War, Baku produced 15% of the world's oil. The Germans attempted to capture the city by sending troops through Ukraine, but their attempt was foiled by the British, lead by General Lionel Dunsterville. When the Russian impire collapsed in 1918 Azerbaijan declared their independence. A brief taste of freedom that only lasted until April the 27th, 1920 when units of the new Red Army crossed the border and forced the country back into the Soviet Union.
"If we don't get the oil from Baku", Hitler shouted to his generals during the invation of the Soviet Union in 1941, operation Barbarossa, "the war is lost". So a side show to operation "Blue", the attack to capture the city of Stalingrad and to cut off Russian supplies sailed up the river Volga, called "Edelweis" was launched in order to capture the oil fields in and around Baku. The operation failed due to the Red Army victory at Stalingrad, now Volgograd, and Hitler lost the war.
What was lost in the spring of 1920 became a reality in 1991 with the collapse of the Soviet Union. Azerbaijan, with its capitl Baku, became once again and independent republic, since transforming itself into a modern western capital, with a deep respect for its turbulent and eventful past.