Iran couldn't go to war with Azerbaijan the same reason they couldn't with bahrain when they cracked down on their supporters hard nor could it with anyone in the gulf it puts them into a massive miscalculation that could potentially spell their end it is not worth taking the risk.
Iran has not reached the treeshold of threat yet and far from it. It could only reach that if it grows significiantly in the future somehow magicially reach 300m population wise and evolve tech wise while everyone else regresses and that could take what like another century but nobody is regressing everyone is evolving which is unlikely we will see a regress happening across the abroad