Most travellers that pass through Azerbaijan on their way to or from Central Asia, and generally take the direct but boring route from Tbilisi to Baki (Baku) across the central plains. For travellers tha travel on their own a far better route would be, if you have the time, is to head through the Georgian region of Kakheti to Lagodekhi, and take the hill-foot road through Zaqatala, Sheki, Gabala and Shamahi.
Unfortunately, the land border with Iran is closed to foreigners, and the border with Russia to the north is also problematic, so the only onward options are the Caspian Sea ferries to Turkmenbashi in Turkmenistan and Bandar-e Anzali in Iran. If you are planning to return west from Baki, an interesting alternative to going back through Georgia is to fly to Nahchivan and exit from there into Turkey.
Winter in Azerbaijan is cold and miserable, even in Baki, and the most interesting parts of the country - the mountains - are often cut off by snow. In early spring the melting snow causes torrential floods in the valleys leading out of the hills, and many valley roads and trails will be impassable due to flooding or landslides. The passes over the mountains are usually free of snow from June to October.
There is no real springtime in Baki - the father changes fairly swiftly from chilly to hot sometimes in April. May and June are the best times to visit the city - Baki and the Caspian coast might be very hot in July and August. Though if you are planning to spend most of your time on local beaches that would be only more welcome.
A week in Azerbaijan would be enough time to see Baki and Sheki. With two weeks you could add in Qobustan and a side trip to Quba or Lenkaran. The only reason to stay for a month would be to enjoy the Caspian sea and do some serious trekking in the mountains. It is always better to have a local guide accompanying you, but for those who likes adventures, have a heady feeling of exploring new and unknown, Azerbaijan is a gratifying land. Meet and enjoy it!