You can get away with 3 days if you're in a rush, you would be able to visit Baku, and the Gobustan Natinal park (the UNESCO world heritage site home to the mud volcanoes). You could also spend 2 weeks and see the whole country! Personally, though, I think 5 nights is the perfect amount of time to spend in Azerbaijan.